@ar.io/sdk 2.1.0-alpha.5 → 2.1.0-alpha.7

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
@@ -6,18 +6,24 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
6
6
 
7
7
  ## Table of Contents
8
8
 
9
+ <!-- toc -->
10
+
11
+ - [Table of Contents](#table-of-contents)
9
12
  - [Prerequisites](#prerequisites)
10
13
  - [Installation](#installation)
11
14
  - [Quick Start](#quick-start)
12
15
  - [Usage](#usage)
13
16
  - [Web](#web)
17
+ - [Bundlers (Webpack, Rollup, ESbuild, etc.)](#bundlers-webpack-rollup-esbuild-etc)
18
+ - [Browser](#browser)
14
19
  - [Node](#node)
20
+ - [ESM (NodeNext)](#esm-nodenext)
21
+ - [CJS](#cjs)
15
22
  - [Typescript](#typescript)
16
23
  - [IOToken & mIOToken](#iotoken--miotoken)
17
24
  - [Converting IO to mIO](#converting-io-to-mio)
18
25
  - [IO Process](#io-process)
19
-
20
- - [IO APIs](#apis)
26
+ - [APIs](#apis)
21
27
  - [`init({ signer })`](#init-signer-)
22
28
  - [`getInfo()`](#getinfo)
23
29
  - [`getTokenSupply()`](#gettokensupply)
@@ -32,6 +38,7 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
32
38
  - [`getEpoch({ epochIndex })`](#getepoch-epochindex-)
33
39
  - [`getCurrentEpoch()`](#getcurrentepoch)
34
40
  - [`getPrescribedObservers({ epochIndex })`](#getprescribedobservers-epochindex-)
41
+ - [`getTokenCost({ intent, ...args })`](#gettokencost-intent-args-)
35
42
  - [`joinNetwork(params)`](#joinnetworkparams)
36
43
  - [`leaveNetwork()`](#leavenetwork)
37
44
  - [`updateGatewaySettings(gatewaySettings)`](#updategatewaysettingsgatewaysettings)
@@ -43,13 +50,12 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
43
50
  - [`transfer({ target, qty })`](#transfer-target-qty-)
44
51
  - [`increaseUndernameLimit({ name, qty })`](#increaseundernamelimit-name-qty-)
45
52
  - [`extendLease({ name, years })`](#extendlease-name-years-)
46
- - [Configuration](#custom-configuration)
47
-
53
+ - [Configuration](#configuration)
48
54
  - [Arweave Name Tokens (ANT's)](#arweave-name-tokens-ants)
49
-
50
55
  - [ANT APIs](#ant-apis)
51
56
  - [`init({ processId, signer })`](#init-processid-signer-)
52
- - [`getInfo()`](#getinfo)
57
+ - [`getInfo()`](#getinfo-1)
58
+ - [`getState()`](#getstate)
53
59
  - [`getOwner()`](#getowner)
54
60
  - [`getControllers()`](#getcontrollers)
55
61
  - [`getRecords()`](#getrecords)
@@ -60,21 +66,19 @@ This is the home of [ar.io] SDK. This SDK provides functionality for interacting
60
66
  - [`removeRecord({ undername })`](#removerecord-undername-)
61
67
  - [`setName({ name })`](#setname-name-)
62
68
  - [`setTicker({ ticker })`](#setticker-ticker-)
63
- - [Configuration](#configuration)
64
-
69
+ - [Configuration](#configuration-1)
65
70
  - [Logging](#logging)
66
-
67
- - [Configuration](#configuration)
68
-
71
+ - [Configuration](#configuration-2)
69
72
  - [Pagination](#pagination)
70
-
71
73
  - [Developers](#developers)
72
74
  - [Requirements](#requirements)
73
- - [Setup \& Build](#setup--build)
75
+ - [Setup & Build](#setup--build)
74
76
  - [Testing](#testing)
75
- - [Linting \& Formatting](#linting--formatting)
77
+ - [Linting & Formatting](#linting--formatting)
76
78
  - [Architecture](#architecture)
77
79
 
80
+ <!-- tocstop -->
81
+
78
82
  ## Prerequisites
79
83
 
80
84
  - `node>=v18.0.0`
@@ -128,7 +132,15 @@ const gateways = await io.getGateways();
128
132
  "totalEpochsPrescribedCount": 31
129
133
  },
130
134
  "status": "joined",
131
- "vaults": {}
135
+ "vaults": {},
136
+ "weights": {
137
+ "compositeWeight": 0.97688888893556,
138
+ "gatewayRewardRatioWeight": 1,
139
+ "tenureWeight": 0.19444444444444,
140
+ "observerRewardRatioWeight": 1,
141
+ "normalizedCompositeWeight": 0.19247316211083,
142
+ "stakeWeight": 5.02400000024
143
+ }
132
144
  }
133
145
  ],
134
146
  "hasMore": true,
@@ -368,7 +380,15 @@ const gateway = await io.getGateway({
368
380
  "totalEpochsPrescribedCount": 31
369
381
  },
370
382
  "status": "joined",
371
- "vaults": {}
383
+ "vaults": {},
384
+ "weights": {
385
+ "compositeWeight": 0.97688888893556,
386
+ "gatewayRewardRatioWeight": 1,
387
+ "tenureWeight": 0.19444444444444,
388
+ "observerRewardRatioWeight": 1,
389
+ "normalizedCompositeWeight": 0.19247316211083,
390
+ "stakeWeight": 5.02400000024
391
+ }
372
392
  }
373
393
  ```
374
394
 
@@ -416,7 +436,15 @@ Available `sortBy` options are any of the keys on the gateway object, e.g. `oper
416
436
  "totalEpochsPrescribedCount": 31
417
437
  },
418
438
  "status": "joined",
419
- "vaults": {}
439
+ "vaults": {},
440
+ "weights": {
441
+ "compositeWeight": 0.97688888893556,
442
+ "gatewayRewardRatioWeight": 1,
443
+ "tenureWeight": 0.19444444444444,
444
+ "observerRewardRatioWeight": 1,
445
+ "normalizedCompositeWeight": 0.19247316211083,
446
+ "stakeWeight": 5.02400000024
447
+ }
420
448
  }
421
449
  ],
422
450
  "hasMore": true,
@@ -981,7 +1009,7 @@ The ANT client class exposes APIs relevant to compliant Arweave Name Token proce
981
1009
 
982
1010
  ### ANT APIs
983
1011
 
984
- #### `init({ processId, signer )`
1012
+ #### `init({ processId, signer })`
985
1013
 
986
1014
  Factory function to that creates a read-only or writeable client. By providing a `signer` additional write APIs that require signing, like `setRecord` and `transfer` are available. By default, a read-only client is returned and no write APIs are available.
987
1015
 
@@ -1021,6 +1049,49 @@ const info = await ant.getInfo();
1021
1049
 
1022
1050
  </details>
1023
1051
 
1052
+ #### `getState()`
1053
+
1054
+ Retrieves the state of the ANT process.
1055
+
1056
+ ```typescript
1057
+ const state = await ant.getState();
1058
+ ```
1059
+
1060
+ <details>
1061
+ <summary>Output</summary>
1062
+
1063
+ ```json
1064
+ {
1065
+ "TotalSupply": 1,
1066
+ "Balances": {
1067
+ "98O1_xqDLrBKRfQPWjF5p7xZ4Jx6GM8P5PeJn26xwUY": 1
1068
+ },
1069
+ "Controllers": [],
1070
+ "Records": {
1071
+ "v1-0-0_whitepaper": {
1072
+ "transactionId": "lNjWn3LpyhKC95Kqe-x8X2qgju0j98MhucdDKK85vc4",
1073
+ "ttlSeconds": 900
1074
+ },
1075
+ "@": {
1076
+ "transactionId": "2rMLb2uHAyEt7jSu6bXtKx8e-jOfIf7E-DOgQnm8EtU",
1077
+ "ttlSeconds": 3600
1078
+ },
1079
+ "whitepaper": {
1080
+ "transactionId": "lNjWn3LpyhKC95Kqe-x8X2qgju0j98MhucdDKK85vc4",
1081
+ "ttlSeconds": 900
1082
+ }
1083
+ },
1084
+ "Initialized": true,
1085
+ "Ticker": "ANT-AR-IO",
1086
+ "Logo": "Sie_26dvgyok0PZD_-iQAFOhOd5YxDTkczOLoqTTL_A",
1087
+ "Denomination": 0,
1088
+ "Name": "AR.IO Foundation",
1089
+ "Owner": "98O1_xqDLrBKRfQPWjF5p7xZ4Jx6GM8P5PeJn26xwUY"
1090
+ }
1091
+ ```
1092
+
1093
+ </details>
1094
+
1024
1095
  #### `getOwner()`
1025
1096
 
1026
1097
  Returns the owner of the configured ANT process.