@ar.io/sdk 2.3.2 → 2.4.0-alpha.1

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 (56) hide show
  1. package/README.md +37 -3
  2. package/bundles/web.bundle.min.js +63 -63
  3. package/lib/cjs/common/ant-registry.js +8 -8
  4. package/lib/cjs/common/ant.js +47 -24
  5. package/lib/cjs/common/io.js +14 -1
  6. package/lib/cjs/node/index.js +1 -1
  7. package/lib/cjs/types/ant.js +122 -0
  8. package/lib/cjs/types/common.js +2 -0
  9. package/lib/cjs/{io.js → types/io.js} +1 -1
  10. package/lib/cjs/{token.js → types/token.js} +1 -1
  11. package/lib/cjs/utils/ao.js +1 -35
  12. package/lib/cjs/utils/arweave.js +15 -0
  13. package/lib/cjs/utils/index.js +1 -0
  14. package/lib/cjs/utils/processes.js +1 -0
  15. package/lib/cjs/utils/schema.js +17 -0
  16. package/lib/cjs/version.js +1 -1
  17. package/lib/cjs/web/index.js +1 -1
  18. package/lib/esm/common/ant-registry.js +1 -1
  19. package/lib/esm/common/ant.js +40 -17
  20. package/lib/esm/common/io.js +14 -1
  21. package/lib/esm/node/index.js +1 -1
  22. package/lib/esm/types/ant.js +118 -0
  23. package/lib/esm/types/common.js +1 -0
  24. package/lib/esm/{io.js → types/io.js} +1 -1
  25. package/lib/esm/{token.js → types/token.js} +1 -1
  26. package/lib/esm/utils/ao.js +0 -33
  27. package/lib/esm/utils/arweave.js +15 -0
  28. package/lib/esm/utils/index.js +1 -0
  29. package/lib/esm/utils/processes.js +1 -0
  30. package/lib/esm/utils/schema.js +13 -0
  31. package/lib/esm/version.js +1 -1
  32. package/lib/esm/web/index.js +1 -1
  33. package/lib/types/common/ant-registry.d.ts +2 -1
  34. package/lib/types/common/ant.d.ts +23 -29
  35. package/lib/types/common/contracts/ao-process.d.ts +1 -1
  36. package/lib/types/common/http.d.ts +1 -1
  37. package/lib/types/common/io.d.ts +8 -3
  38. package/lib/types/node/index.d.ts +1 -1
  39. package/lib/types/types/ant-registry.d.ts +29 -0
  40. package/lib/types/types/ant.d.ts +190 -0
  41. package/lib/types/{common.d.ts → types/common.d.ts} +20 -0
  42. package/lib/types/{io.d.ts → types/io.d.ts} +7 -103
  43. package/lib/types/utils/ao.d.ts +2 -60
  44. package/lib/types/utils/arweave.d.ts +1 -16
  45. package/lib/types/utils/index.d.ts +1 -0
  46. package/lib/types/utils/processes.d.ts +2 -1
  47. package/lib/types/utils/schema.d.ts +23 -0
  48. package/lib/types/version.d.ts +1 -1
  49. package/lib/types/web/index.d.ts +1 -1
  50. package/package.json +1 -1
  51. /package/lib/cjs/{common.js → types/ant-registry.js} +0 -0
  52. /package/lib/cjs/{types.js → types/index.js} +0 -0
  53. /package/lib/esm/{common.js → types/ant-registry.js} +0 -0
  54. /package/lib/esm/{types.js → types/index.js} +0 -0
  55. /package/lib/types/{types.d.ts → types/index.d.ts} +0 -0
  56. /package/lib/types/{token.d.ts → types/token.d.ts} +0 -0
package/README.md CHANGED
@@ -44,7 +44,8 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
44
44
  - [`leaveNetwork()`](#leavenetwork)
45
45
  - [`updateGatewaySettings(gatewaySettings)`](#updategatewaysettingsgatewaysettings)
46
46
  - [`increaseDelegateStake({ target, qty })`](#increasedelegatestake-target-qty-)
47
- - [`decreaseDelegateStake({ target, qty })`](#decreasedelegatestake-target-qty-)
47
+ - [`decreaseDelegateStake({ target, qty, instant })`](#decreasedelegatestake-target-qty-instant-)
48
+ - [`instantDelegateWithdrawal({ target, vaultId })`](#instantdelegatewithdrawal-target-vaultid-)
48
49
  - [`increaseOperatorStake({ qty })`](#increaseoperatorstake-qty-)
49
50
  - [`decreaseOperatorStake({ qty })`](#decreaseoperatorstake-qty-)
50
51
  - [`saveObservations({ reportTxId, failedGateways })`](#saveobservations-reporttxid-failedgateways-)
@@ -941,9 +942,9 @@ const { id: txId } = await io.increaseDelegateStake(
941
942
  );
942
943
  ```
943
944
 
944
- #### `decreaseDelegateStake({ target, qty })`
945
+ #### `decreaseDelegateStake({ target, qty, instant })`
945
946
 
946
- Decreases the callers stake on the target gateway.
947
+ Decreases the callers stake on the target gateway. Can instantly decrease stake by setting instant to `true`.
947
948
 
948
949
  _Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
949
950
 
@@ -960,6 +961,39 @@ const { id: txId } = await io.decreaseDelegateStake(
960
961
  );
961
962
  ```
962
963
 
964
+ Pay the early withdrawal fee and withdraw instantly.
965
+
966
+ ```typescript
967
+ const io = IO.init({ signer: new ArweaveSigner(jwk) });
968
+ const { id: txId } = await io.decreaseDelegateStake({
969
+ target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
970
+ qty: new IOToken(100).toMIO(),
971
+ instant: true, // Immediately withdraw this stake and pay the instant withdrawal fee
972
+ });
973
+ ```
974
+
975
+ #### `instantDelegateWithdrawal({ target, vaultId })`
976
+
977
+ Instantly withdraws vaulted delegate tokens at the cost of the early withdrawal fee.
978
+
979
+ _Note: Requires `signer` to be provided on `IO.init` to sign the transaction._
980
+
981
+ ```typescript
982
+ const io = IO.init({ signer: new ArweaveSigner(jwk) });
983
+ const { id: txId } = await io.instantDelegateWithdrawal(
984
+ {
985
+ // gateway address where delegate vault exists
986
+ target: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
987
+ // delegated vault id to cancel
988
+ vaultId: 'fDrr0_J4Iurt7caNST02cMotaz2FIbWQ4Kcj616RHl3',
989
+ },
990
+ // optional additional tags
991
+ {
992
+ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }],
993
+ },
994
+ );
995
+ ```
996
+
963
997
  #### `increaseOperatorStake({ qty })`
964
998
 
965
999
  Increases the callers operator stake. Must be executed with a wallet registered as a gateway operator.