Пример #1
0
        public async Task DoP2POffer(string toUserId = null)
        {
            string p2POffer = JwtProviderBuilder.P2P
                              .AddOffer("p2p-" + toUserId, "1")
                              .AddSender(UserId, "p2p", "to myself")
                              .AddRecipient(toUserId ?? UserId, "p2p", "to him?")
                              .Jwt;

            OpenOrder createExternalP2POffer =
                await _marketPlaceClient.CreateExternalOffer(p2POffer).ConfigureAwait(false);

            Order submitP2POffer =
                await _marketPlaceClient.SubmitOrder(createExternalP2POffer.Id).ConfigureAwait(false);

            SubmitTransactionResponse submitTransactionResponse = await _blockChainHandler.SendPayment(_keyPair,
                                                                                                       submitP2POffer.BlockChainData.RecipientAddress,
                                                                                                       submitP2POffer.Amount, submitP2POffer.Id).ConfigureAwait(false);

            Order finishedOrder = await WaitForOrderCompletion(UserId, submitP2POffer.Id).ConfigureAwait(false);

            if (!string.IsNullOrEmpty(finishedOrder?.Result?.Jwt))
            {
                SecurityToken token = _marketPlaceJwtProvider.ValidateJwtToken(finishedOrder?.Result?.Jwt);
            }
        }
Пример #2
0
        public async Task FirstTest()
        {
            //Creating a market place user
            _authToken = await _marketPlaceClient.Users(GetSignInData()).ConfigureAwait(false);

            _authToken = await _marketPlaceClient.UsersMeActivate().ConfigureAwait(false);

            //Trusting the KIN asset
            await _blockChainHandler.TryUntilActivated(_keyPair).ConfigureAwait(false);

            //Completing the tutorial!
            var order = await DoFirstOffer().ConfigureAwait(false);


            double balance = await _blockChainHandler.GetKinBalance(_keyPair).ConfigureAwait(false);

            var txResponse = await _blockChainHandler.SendPayment(_keyPair, order.BlockChainData.SenderAddress, balance).ConfigureAwait(false);
        }