@ardrive/turbo-sdk 1.33.1 → 1.34.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +49 -6
  2. package/bundles/web.bundle.min.js +103598 -103276
  3. package/lib/cjs/cli/cli.js +1 -1
  4. package/lib/cjs/cli/commands/cryptoFund.js +3 -1
  5. package/lib/cjs/common/payment.js +17 -4
  6. package/lib/cjs/common/signer.js +16 -1
  7. package/lib/cjs/common/token/ario.js +27 -19
  8. package/lib/cjs/common/token/arweave.js +4 -1
  9. package/lib/cjs/common/token/baseEth.js +7 -6
  10. package/lib/cjs/common/token/erc20.js +91 -0
  11. package/lib/cjs/common/token/ethereum.js +38 -18
  12. package/lib/cjs/common/token/index.js +11 -0
  13. package/lib/cjs/common/token/polygon.js +7 -6
  14. package/lib/cjs/common/token/solana.js +11 -2
  15. package/lib/cjs/common/token/usdc.js +83 -0
  16. package/lib/cjs/common/upload.js +6 -1
  17. package/lib/cjs/types.js +3 -0
  18. package/lib/cjs/utils/common.js +71 -4
  19. package/lib/cjs/version.js +1 -1
  20. package/lib/esm/cli/cli.js +1 -1
  21. package/lib/esm/cli/commands/cryptoFund.js +3 -1
  22. package/lib/esm/common/payment.js +17 -4
  23. package/lib/esm/common/signer.js +17 -2
  24. package/lib/esm/common/token/ario.js +27 -19
  25. package/lib/esm/common/token/arweave.js +4 -1
  26. package/lib/esm/common/token/baseEth.js +6 -5
  27. package/lib/esm/common/token/erc20.js +87 -0
  28. package/lib/esm/common/token/ethereum.js +37 -18
  29. package/lib/esm/common/token/index.js +11 -0
  30. package/lib/esm/common/token/polygon.js +6 -5
  31. package/lib/esm/common/token/solana.js +11 -2
  32. package/lib/esm/common/token/usdc.js +76 -0
  33. package/lib/esm/common/upload.js +6 -1
  34. package/lib/esm/types.js +3 -0
  35. package/lib/esm/utils/common.js +66 -5
  36. package/lib/esm/version.js +1 -1
  37. package/lib/types/cli/commands/cryptoFund.d.ts.map +1 -1
  38. package/lib/types/cli/types.d.ts +1 -0
  39. package/lib/types/cli/types.d.ts.map +1 -1
  40. package/lib/types/common/payment.d.ts +1 -1
  41. package/lib/types/common/payment.d.ts.map +1 -1
  42. package/lib/types/common/signer.d.ts +2 -2
  43. package/lib/types/common/signer.d.ts.map +1 -1
  44. package/lib/types/common/token/ario.d.ts +1 -1
  45. package/lib/types/common/token/ario.d.ts.map +1 -1
  46. package/lib/types/common/token/arweave.d.ts +1 -1
  47. package/lib/types/common/token/arweave.d.ts.map +1 -1
  48. package/lib/types/common/token/baseEth.d.ts +5 -0
  49. package/lib/types/common/token/baseEth.d.ts.map +1 -1
  50. package/lib/types/common/token/erc20.d.ts +19 -0
  51. package/lib/types/common/token/erc20.d.ts.map +1 -0
  52. package/lib/types/common/token/ethereum.d.ts +4 -2
  53. package/lib/types/common/token/ethereum.d.ts.map +1 -1
  54. package/lib/types/common/token/index.d.ts.map +1 -1
  55. package/lib/types/common/token/polygon.d.ts +5 -0
  56. package/lib/types/common/token/polygon.d.ts.map +1 -1
  57. package/lib/types/common/token/solana.d.ts +2 -1
  58. package/lib/types/common/token/solana.d.ts.map +1 -1
  59. package/lib/types/common/token/usdc.d.ts +36 -0
  60. package/lib/types/common/token/usdc.d.ts.map +1 -0
  61. package/lib/types/common/upload.d.ts.map +1 -1
  62. package/lib/types/types.d.ts +8 -2
  63. package/lib/types/types.d.ts.map +1 -1
  64. package/lib/types/utils/common.d.ts +6 -0
  65. package/lib/types/utils/common.d.ts.map +1 -1
  66. package/lib/types/version.d.ts +1 -1
  67. package/lib/types/version.d.ts.map +1 -1
  68. package/package.json +1 -1
package/README.md CHANGED
@@ -340,11 +340,11 @@ const turbo = TurboFactory.authenticated({
340
340
  }
341
341
  });
342
342
 
343
- // Ethereum Holesky
343
+ // Ethereum Sepolia
344
344
  const turbo = TurboFactory.authenticated({
345
- privateKey: process.env.HOLESKY_PRIVATE_KEY,
345
+ privateKey: process.env.SEPOLIA_PRIVATE_KEY,
346
346
  token: 'ethereum',
347
- gatewayUrl: 'https://ethereum-holesky-rpc.publicnode.com',
347
+ gatewayUrl: 'https://eth-sepolia.public.blastapi.io',
348
348
  paymentServiceConfig: {
349
349
  url: 'https://payment.ardrive.dev',
350
350
  },
@@ -358,7 +358,7 @@ const turbo = TurboFactory.authenticated({
358
358
 
359
359
  - **Base Sepolia** (`base-eth`) - Supports on-demand funding
360
360
  - **Solana Devnet** (`solana`) - Supports on-demand funding
361
- - **Ethereum Holesky** (`ethereum`) - Manual top-up only
361
+ - **Ethereum Sepolia** (`ethereum`) - Manual top-up only
362
362
  - **Polygon Amoy** (`pol`) - Manual top-up only
363
363
 
364
364
  ### TurboUnauthenticatedClient
@@ -730,7 +730,7 @@ With the upload methods, you can choose to Top Up with selected crypto token on
730
730
 
731
731
  This is done by providing the `OnDemandFunding` class to the `fundingMode` parameter on upload methods. The `maxTokenAmount` (optional) is the maximum amount of tokens in the token type's smallest unit value (e.g: Winston for arweave token type) to fund the wallet with. The `topUpBufferMultiplier` (optional) is the multiplier to apply to the estimated top-up amount to avoid underpayment during on-demand top-ups due to price fluctuations on longer uploads. Defaults to 1.1, meaning a 10% buffer.
732
732
 
733
- Note: On demand API currently only available for $ARIO (`ario`), $SOL (`solana`), and $ETH on Base Network (`base-eth`) token types.
733
+ Note: On demand API currently only available for $ARIO (`ario`), $SOL (`solana`), $ETH on Base Network (`base-eth`) and $USDC on Base Network (`base-usdc`) token types.
734
734
 
735
735
  ```typescript
736
736
  const turbo = TurboFactory.authenticated({
@@ -869,12 +869,13 @@ const { manifest, fileResponses, manifestResponse } = await turbo.uploadFolder({
869
869
  });
870
870
  ```
871
871
 
872
- #### `topUpWithTokens({ tokenAmount, feeMultiplier })`
872
+ #### `topUpWithTokens({ tokenAmount, feeMultiplier, turboCreditDestinationAddress })`
873
873
 
874
874
  Tops up the connected wallet with Credits by submitting a payment transaction for the token amount to the Turbo wallet and then submitting that transaction id to Turbo Payment Service for top up processing.
875
875
 
876
876
  - The `tokenAmount` is the amount of tokens in the token type's smallest unit value (e.g: Winston for arweave token type) to fund the wallet with.
877
877
  - The `feeMultiplier` (optional) is the multiplier to apply to the reward for the transaction to modify its chances of being mined. Credits will be added to the wallet balance after the transaction is confirmed on the given blockchain. Defaults to 1.0, meaning no multiplier.
878
+ - The `turboCreditDestinationAddress` (optional) is the native address to credit the funds to. If not provided, the connected wallet's native address will be used. Note: Not available for KYVE token type.
878
879
 
879
880
  ##### Arweave (AR) Crypto Top Up
880
881
 
@@ -884,6 +885,7 @@ const turbo = TurboFactory.authenticated({ signer, token: 'arweave' });
884
885
  const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
885
886
  tokenAmount: WinstonToTokenAmount(100_000_000), // 0.0001 AR
886
887
  feeMultiplier: 1.1, // 10% increase in reward for improved mining chances
888
+ turboCreditDestinationAddress: '0xabc...123', // Any custom EVM / SOL / AR / KYVE native destination address
887
889
  });
888
890
  ```
889
891
 
@@ -897,6 +899,36 @@ const { winc, status, id, ...fundResult } = await turbo.topUpWithTokens({
897
899
  });
898
900
  ```
899
901
 
902
+ ##### USDC Crypto Top Up
903
+
904
+ ```typescript
905
+
906
+ // USDC on Ethereum Mainnet
907
+ const { winc, status, id, ...fundResult } = await TurboFactory.authenticated({
908
+ signer,
909
+ token: 'usdc',
910
+ }).topUpWithTokens({
911
+ tokenAmount: USDCToTokenAmount(1), // 1 USDC
912
+ });
913
+
914
+ // USDC on Base Network
915
+ const { winc, status, id, ...fundResult } = await TurboFactory.authenticated({
916
+ signer,
917
+ token: 'base-usdc',
918
+ }).topUpWithTokens({
919
+ tokenAmount: USDCToTokenAmount(1), // 1 USDC
920
+ });
921
+
922
+
923
+ // USDC on Polygon Network
924
+ const { winc, status, id, ...fundResult } = await TurboFactory.authenticated({
925
+ signer,
926
+ token: 'polygon-usdc',
927
+ }).topUpWithTokens({
928
+ tokenAmount: USDCToTokenAmount(1), // 1 USDC
929
+ });
930
+ ```
931
+
900
932
  ##### Ethereum (ETH) Crypto Top Up
901
933
 
902
934
  ```typescript
@@ -1185,9 +1217,15 @@ Command Options:
1185
1217
 
1186
1218
  - `-v, --value <value>` - Value of crypto token for fund. e.g: 0.0001 for 0.0001 KYVE
1187
1219
  - `-i, --tx-id <txId>` - Transaction ID of an existing funding transaction
1220
+ - `-a, --address <nativeAddress>` - Optional native address to send the Turbo credits to
1188
1221
 
1189
1222
  e.g:
1190
1223
 
1224
+ ```shell
1225
+ # Fund any valid destination wallet with 10 USDC worth of Turbo Credits on Base Network
1226
+ turbo crypto-fund --value 10 --token base-usdc --private-key '0xabc...123' --address 'any-valid-evm-sol-ar-kyve-native-address'
1227
+ ```
1228
+
1191
1229
  ```shell
1192
1230
  turbo crypto-fund --value 0.0001 --token kyve --private-key 'b27...45c'
1193
1231
  ```
@@ -1205,6 +1243,11 @@ turbo crypto-fund --value 100 --token ario --wallet-file ../path/to/arweave/wall
1205
1243
  turbo crypto-fund --value 100 --token ario --process-id agYcCFJtrMG6cqMuZfskIkFTGvUPddICmtQSBIoPdiA --cu-url https://cu.ao-testnet.xyz
1206
1244
  ```
1207
1245
 
1246
+ ```shell
1247
+ # Send to custom destination address
1248
+ turbo crypto-fund --value 100 --token ario --wallet-file ../path/to/arweave/wallet/with/ario.json --address 'Any-Valid-AR-EVM-SOL-KYVE-Native-Address'
1249
+ ```
1250
+
1208
1251
  ##### `upload-folder`
1209
1252
 
1210
1253
  Upload a folder of files and create and upload a manifest file for the folder upload to the Turbo Upload Service.