@ar.io/sdk 3.0.0 → 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 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.