@ar.io/sdk 3.0.1-alpha.1 → 3.1.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.
- package/README.md +38 -0
- package/bundles/web.bundle.min.js +64 -64
- package/lib/cjs/cli/cli.js +8 -2
- package/lib/cjs/cli/commands/readCommands.js +22 -22
- package/lib/cjs/cli/options.js +6 -0
- package/lib/cjs/cli/utils.js +21 -1
- package/lib/cjs/common/contracts/ao-process.js +7 -3
- package/lib/cjs/common/io.js +47 -1
- package/lib/cjs/types/io.js +6 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/cli/cli.js +9 -3
- package/lib/esm/cli/commands/readCommands.js +21 -22
- package/lib/esm/cli/options.js +6 -0
- package/lib/esm/cli/utils.js +20 -1
- package/lib/esm/common/contracts/ao-process.js +7 -3
- package/lib/esm/common/io.js +47 -1
- package/lib/esm/types/io.js +4 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/cli/commands/readCommands.d.ts +24 -2
- package/lib/types/cli/options.d.ts +4 -0
- package/lib/types/cli/utils.d.ts +9 -1
- package/lib/types/common/contracts/ao-process.d.ts +2 -1
- package/lib/types/common/io.d.ts +2 -1
- package/lib/types/types/io.d.ts +31 -3
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,6 +58,7 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
|
|
|
58
58
|
- [`increaseUndernameLimit({ name, qty })`](#increaseundernamelimit-name-qty-)
|
|
59
59
|
- [`extendLease({ name, years })`](#extendlease-name-years-)
|
|
60
60
|
- [`getTokenCost({ intent, ...args })`](#gettokencost-intent-args-)
|
|
61
|
+
- [`getCostDetails({ intent, fromAddress, fundFrom, ...args})`](#getcostdetails-intent-fromaddress-fundfrom-args)
|
|
61
62
|
- [`getDemandFactor()`](#getdemandfactor)
|
|
62
63
|
- [`getArNSReturnedNames({ cursor, limit, sortBy, sortOrder })`](#getarnsreturnednames-cursor-limit-sortby-sortorder-)
|
|
63
64
|
- [`getArNSReturnedName({ name })`](#getarnsreturnedname-name-)
|
|
@@ -1200,6 +1201,43 @@ const price = await ario
|
|
|
1200
1201
|
|
|
1201
1202
|
</details>
|
|
1202
1203
|
|
|
1204
|
+
#### `getCostDetails({ intent, fromAddress, fundFrom, ...args})`
|
|
1205
|
+
|
|
1206
|
+
Calculates the expanded cost details for the interaction in question, e.g a 'Buy-Record' interaction, where args are the specific params for that interaction. The fromAddress is the address that would be charged for the interaction, and fundFrom is where the funds would be taken from, either `balance`, `stakes`, or `any`.
|
|
1207
|
+
|
|
1208
|
+
```typescript
|
|
1209
|
+
const costDetails = await ario.getCostDetails({
|
|
1210
|
+
intent: 'Buy-Record',
|
|
1211
|
+
fromAddress: 't4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3',
|
|
1212
|
+
fundFrom: 'stakes',
|
|
1213
|
+
name: 'ar-io',
|
|
1214
|
+
type: 'permabuy',
|
|
1215
|
+
});
|
|
1216
|
+
```
|
|
1217
|
+
|
|
1218
|
+
<details>
|
|
1219
|
+
<summary>Output</summary>
|
|
1220
|
+
|
|
1221
|
+
```json
|
|
1222
|
+
{
|
|
1223
|
+
"tokenCost": 2384252273,
|
|
1224
|
+
"fundingPlan": {
|
|
1225
|
+
"address": "t4Xr0_J4Iurt7caNST02cMotaz2FIbWQ4Kbj616RHl3",
|
|
1226
|
+
"balance": 0,
|
|
1227
|
+
"stakes": {
|
|
1228
|
+
"Rc80LG6h27Y3p9TN6J5hwDeG5M51cu671YwZpU9uAVE": {
|
|
1229
|
+
"vaults": [],
|
|
1230
|
+
"delegatedStake": 2384252273
|
|
1231
|
+
}
|
|
1232
|
+
},
|
|
1233
|
+
"shortfall": 0
|
|
1234
|
+
},
|
|
1235
|
+
"discounts": []
|
|
1236
|
+
}
|
|
1237
|
+
```
|
|
1238
|
+
|
|
1239
|
+
</details>
|
|
1240
|
+
|
|
1203
1241
|
#### `getDemandFactor()`
|
|
1204
1242
|
|
|
1205
1243
|
Retrieves the current demand factor of the network. The demand factor is a multiplier applied to the cost of ArNS interactions based on the current network demand.
|