|
54 | 54 | // originTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC on Ethereum
|
55 | 55 | // destinationChainId: 324,
|
56 | 56 | // destinationTokenAddress: Constants.NATIVE_TOKEN_ADDRESS, // ETH on zkSync
|
57 |
| -// buyAmountWei: BigInteger.Parse("0.1".ToWei()) |
| 57 | +// buyAmountWei: BigInteger.Parse("0.01".ToWei()) |
58 | 58 | // );
|
59 | 59 | // Console.WriteLine($"Buy quote: {JsonConvert.SerializeObject(buyQuote, Formatting.Indented)}");
|
60 | 60 |
|
|
64 | 64 | // originTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC on Ethereum
|
65 | 65 | // destinationChainId: 324,
|
66 | 66 | // destinationTokenAddress: Constants.NATIVE_TOKEN_ADDRESS, // ETH on zkSync
|
67 |
| -// buyAmountWei: BigInteger.Parse("0.1".ToWei()), |
| 67 | +// buyAmountWei: BigInteger.Parse("0.01".ToWei()), |
68 | 68 | // sender: await Utils.GetAddressFromENS(client, "vitalik.eth"),
|
69 | 69 | // receiver: await myWallet.GetAddress()
|
70 | 70 | // );
|
71 |
| -// Console.WriteLine($"Prepared Buy contains {preparedBuy.Transactions.Count} transaction(s)!"); |
| 71 | +// Console.WriteLine($"Prepared Buy contains {preparedBuy.Steps.Count} steps(s) with a total of {preparedBuy.Steps.Sum(step => step.Transactions.Count)} transactions!"); |
72 | 72 |
|
73 | 73 | // // Sell - Get a quote for selling a specific amount of tokens
|
74 | 74 | // var sellQuote = await bridge.Sell_Quote(
|
75 | 75 | // originChainId: 324,
|
76 | 76 | // originTokenAddress: Constants.NATIVE_TOKEN_ADDRESS, // ETH on zkSync
|
77 | 77 | // destinationChainId: 1,
|
78 | 78 | // destinationTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC on Ethereum
|
79 |
| -// sellAmountWei: BigInteger.Parse("0.1".ToWei()) |
| 79 | +// sellAmountWei: BigInteger.Parse("0.01".ToWei()) |
80 | 80 | // );
|
81 | 81 | // Console.WriteLine($"Sell quote: {JsonConvert.SerializeObject(sellQuote, Formatting.Indented)}");
|
82 | 82 |
|
|
86 | 86 | // originTokenAddress: Constants.NATIVE_TOKEN_ADDRESS, // ETH on zkSync
|
87 | 87 | // destinationChainId: 1,
|
88 | 88 | // destinationTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC on Ethereum
|
89 |
| -// sellAmountWei: BigInteger.Parse("0.1".ToWei()), |
| 89 | +// sellAmountWei: BigInteger.Parse("0.01".ToWei()), |
90 | 90 | // sender: await Utils.GetAddressFromENS(client, "vitalik.eth"),
|
91 | 91 | // receiver: await myWallet.GetAddress()
|
92 | 92 | // );
|
93 |
| -// Console.WriteLine($"Prepared Sell contains {preparedSell.Transactions.Count} transaction(s)!"); |
| 93 | +// Console.WriteLine($"Prepared Sell contains {preparedBuy.Steps.Count} steps(s) with a total of {preparedBuy.Steps.Sum(step => step.Transactions.Count)} transactions!"); |
94 | 94 |
|
95 | 95 | // // Transfer - Get an executable transaction for transferring a specific amount of tokens
|
96 | 96 | // var preparedTransfer = await bridge.Transfer_Prepare(
|
97 | 97 | // chainId: 137,
|
98 |
| -// tokenAddress: Constants.NATIVE_TOKEN_ADDRESS, // ETH on zkSync |
99 |
| -// transferAmountWei: BigInteger.Parse("0.1".ToWei()), |
| 98 | +// tokenAddress: Constants.NATIVE_TOKEN_ADDRESS, // POL on Polygon |
| 99 | +// transferAmountWei: BigInteger.Parse("0.01".ToWei()), |
100 | 100 | // sender: await Utils.GetAddressFromENS(client, "vitalik.eth"),
|
101 | 101 | // receiver: await myWallet.GetAddress()
|
102 | 102 | // );
|
|
128 | 128 | // var transferHashes = transferResult.Select(receipt => receipt.TransactionHash).ToList();
|
129 | 129 | // Console.WriteLine($"Transfer hashes: {JsonConvert.SerializeObject(transferHashes, Formatting.Indented)}");
|
130 | 130 |
|
| 131 | +// // Onramp - Get a quote for buying crypto with Fiat |
| 132 | +// var preparedOnramp = await bridge.Onramp_Prepare( |
| 133 | +// onramp: OnrampProvider.Coinbase, |
| 134 | +// chainId: 8453, |
| 135 | +// tokenAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // USDC on Base |
| 136 | +// amount: "10000000", |
| 137 | +// receiver: await myWallet.GetAddress() |
| 138 | +// ); |
| 139 | +// Console.WriteLine($"Onramp link: {preparedOnramp.Link}"); |
| 140 | +// Console.WriteLine($"Full onramp quote and steps data: {JsonConvert.SerializeObject(preparedOnramp, Formatting.Indented)}"); |
| 141 | + |
| 142 | +// while (true) |
| 143 | +// { |
| 144 | +// var onrampStatus = await bridge.Onramp_Status(id: preparedOnramp.Id); |
| 145 | +// Console.WriteLine($"Full Onramp Status: {JsonConvert.SerializeObject(onrampStatus, Formatting.Indented)}"); |
| 146 | +// if (onrampStatus.StatusType is StatusType.COMPLETED or StatusType.FAILED) |
| 147 | +// { |
| 148 | +// break; |
| 149 | +// } |
| 150 | +// await ThirdwebTask.Delay(5000); |
| 151 | +// } |
| 152 | + |
| 153 | +// if (preparedOnramp.IsSwapRequiredPostOnramp()) |
| 154 | +// { |
| 155 | +// // Execute additional steps that are required post-onramp to get to your token, manually or via the Execute extension |
| 156 | +// var receipts = await bridge.Execute(myWallet, preparedOnramp); |
| 157 | +// Console.WriteLine($"Onramp receipts: {JsonConvert.SerializeObject(receipts, Formatting.Indented)}"); |
| 158 | +// } |
| 159 | +// else |
| 160 | +// { |
| 161 | +// Console.WriteLine("No additional steps required post-onramp, you can use the tokens directly!"); |
| 162 | +// } |
| 163 | + |
131 | 164 | #endregion
|
132 | 165 |
|
133 | 166 | #region Indexer
|
|
728 | 761 |
|
729 | 762 | #endregion
|
730 | 763 |
|
731 |
| -#region Buy with Fiat |
732 |
| - |
733 |
| -// // Supported currencies |
734 |
| -// var supportedCurrencies = await ThirdwebPay.GetBuyWithFiatCurrencies(client); |
735 |
| -// Console.WriteLine($"Supported currencies: {JsonConvert.SerializeObject(supportedCurrencies, Formatting.Indented)}"); |
736 |
| - |
737 |
| -// // Get a Buy with Fiat quote |
738 |
| -// var fiatQuoteParamsWithProvider = new BuyWithFiatQuoteParams(fromCurrencySymbol: "USD", toAddress: walletAddress, toChainId: "137", toTokenAddress: Constants.NATIVE_TOKEN_ADDRESS, toAmount: "20", preferredProvider: "STRIPE"); |
739 |
| -// var fiatQuoteParams = new BuyWithFiatQuoteParams(fromCurrencySymbol: "USD", toAddress: walletAddress, toChainId: "137", toTokenAddress: Constants.NATIVE_TOKEN_ADDRESS, toAmount: "20"); |
740 |
| -// var fiatOnrampQuote = await ThirdwebPay.GetBuyWithFiatQuote(client, fiatQuoteParams); |
741 |
| -// Console.WriteLine($"Fiat onramp quote: {JsonConvert.SerializeObject(fiatOnrampQuote, Formatting.Indented)}"); |
742 |
| - |
743 |
| -// // Get a Buy with Fiat link |
744 |
| -// var onRampLink = ThirdwebPay.BuyWithFiat(fiatOnrampQuote); |
745 |
| -// Console.WriteLine($"Fiat onramp link: {onRampLink}"); |
746 |
| - |
747 |
| -// // Open onramp link to start the process (use your framework's version of this) |
748 |
| -// var psi = new ProcessStartInfo { FileName = onRampLink, UseShellExecute = true }; |
749 |
| -// _ = Process.Start(psi); |
750 |
| - |
751 |
| -// // Poll for status |
752 |
| -// var currentOnRampStatus = OnRampStatus.NONE; |
753 |
| -// while (currentOnRampStatus is not OnRampStatus.ON_RAMP_TRANSFER_COMPLETED and not OnRampStatus.ON_RAMP_TRANSFER_FAILED) |
754 |
| -// { |
755 |
| -// var onRampStatus = await ThirdwebPay.GetBuyWithFiatStatus(client, fiatOnrampQuote.IntentId); |
756 |
| -// currentOnRampStatus = Enum.Parse<OnRampStatus>(onRampStatus.Status); |
757 |
| -// Console.WriteLine($"Fiat onramp status: {JsonConvert.SerializeObject(onRampStatus, Formatting.Indented)}"); |
758 |
| -// await Task.Delay(5000); |
759 |
| -// } |
760 |
| - |
761 |
| -#endregion |
762 |
| - |
763 |
| -#region Buy with Crypto |
764 |
| - |
765 |
| -// // Swap Polygon MATIC to Base ETH |
766 |
| -// var swapQuoteParams = new BuyWithCryptoQuoteParams( |
767 |
| -// fromAddress: walletAddress, |
768 |
| -// fromChainId: 137, |
769 |
| -// fromTokenAddress: Constants.NATIVE_TOKEN_ADDRESS, |
770 |
| -// toTokenAddress: Constants.NATIVE_TOKEN_ADDRESS, |
771 |
| -// toChainId: 8453, |
772 |
| -// toAmount: "0.1" |
773 |
| -// ); |
774 |
| -// var swapQuote = await ThirdwebPay.GetBuyWithCryptoQuote(client, swapQuoteParams); |
775 |
| -// Console.WriteLine($"Swap quote: {JsonConvert.SerializeObject(swapQuote, Formatting.Indented)}"); |
776 |
| - |
777 |
| -// // Initiate swap |
778 |
| -// var txHash3 = await ThirdwebPay.BuyWithCrypto(wallet: privateKeyWallet, buyWithCryptoQuote: swapQuote); |
779 |
| -// Console.WriteLine($"Swap transaction hash: {txHash3}"); |
780 |
| - |
781 |
| -// // Poll for status |
782 |
| -// var currentSwapStatus = SwapStatus.NONE; |
783 |
| -// while (currentSwapStatus is not SwapStatus.COMPLETED and not SwapStatus.FAILED) |
784 |
| -// { |
785 |
| -// var swapStatus = await ThirdwebPay.GetBuyWithCryptoStatus(client, txHash3); |
786 |
| -// currentSwapStatus = Enum.Parse<SwapStatus>(swapStatus.Status); |
787 |
| -// Console.WriteLine($"Swap status: {JsonConvert.SerializeObject(swapStatus, Formatting.Indented)}"); |
788 |
| -// await Task.Delay(5000); |
789 |
| -// } |
790 |
| - |
791 |
| -#endregion |
792 |
| - |
793 | 764 | #region Storage Actions
|
794 | 765 |
|
795 | 766 | // // Will download from IPFS or normal urls
|
|
0 commit comments