@ar.io/sdk 3.8.2 → 3.8.3

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isAoANTState = exports.AntInfoSchema = exports.AntHandlersSchema = exports.AntHandlerNames = exports.AntWriteHandlers = exports.AntReadHandlers = exports.AntStateSchema = exports.AntBalancesSchema = exports.AntControllersSchema = exports.AntRecordsSchema = exports.AntRecordSchema = exports.AntKeywordsSchema = exports.AntDescriptionSchema = exports.IntegerStringSchema = exports.ArweaveTxIdSchema = void 0;
3
+ exports.isAoANTState = exports.AntInfoSchema = exports.AntHandlersSchema = exports.AntHandlerNames = exports.AntWriteHandlers = exports.AntReadHandlers = exports.AntStateSchema = exports.AntBalancesSchema = exports.AntControllersSchema = exports.AntRecordsSchema = exports.AntRecordSchema = exports.AntKeywordsSchema = exports.AntDescriptionSchema = exports.IntegerStringSchema = exports.AOAddressSchema = exports.ArweaveTxIdSchema = void 0;
4
4
  /**
5
5
  * Copyright (C) 2022-2024 Permanent Data Solutions, Inc.
6
6
  *
@@ -37,6 +37,9 @@ exports.ArweaveTxIdSchema = zod_1.z
37
37
  .refine((val) => constants_js_1.ARWEAVE_TX_REGEX.test(val), {
38
38
  message: 'Must be an Arweave Transaction ID',
39
39
  });
40
+ exports.AOAddressSchema = zod_1.z.string({
41
+ description: 'AO Address',
42
+ });
40
43
  exports.IntegerStringSchema = zod_1.z
41
44
  .string({
42
45
  description: 'Integer String',
@@ -53,8 +56,8 @@ exports.AntRecordSchema = zod_1.z.object({
53
56
  priority: zod_1.z.number().optional(),
54
57
  });
55
58
  exports.AntRecordsSchema = zod_1.z.record(zod_1.z.string(), exports.AntRecordSchema);
56
- exports.AntControllersSchema = zod_1.z.array(exports.ArweaveTxIdSchema.describe('Controller address'));
57
- exports.AntBalancesSchema = zod_1.z.record(exports.ArweaveTxIdSchema.describe('Holder address'), zod_1.z.number());
59
+ exports.AntControllersSchema = zod_1.z.array(exports.AOAddressSchema.describe('Controller address'));
60
+ exports.AntBalancesSchema = zod_1.z.record(exports.AOAddressSchema.describe('Holder address'), zod_1.z.number());
58
61
  exports.AntStateSchema = zod_1.z.object({
59
62
  Name: zod_1.z.string().describe('The name of the ANT.'),
60
63
  Ticker: zod_1.z.string().describe('The ticker symbol for the ANT.'),
@@ -64,7 +67,7 @@ exports.AntStateSchema = zod_1.z.object({
64
67
  .number()
65
68
  .describe('The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers.')
66
69
  .min(0, { message: 'Denomination must be a non-negative number' }),
67
- Owner: exports.ArweaveTxIdSchema.describe('The Owners address.'),
70
+ Owner: exports.AOAddressSchema.describe('The Owners address.'),
68
71
  Controllers: exports.AntControllersSchema.describe('Controllers of the ANT who have administrative privileges.'),
69
72
  Records: exports.AntRecordsSchema.describe('Records associated with the ANT.'),
70
73
  Balances: exports.AntBalancesSchema.describe('Balance details for each address holding the ANT.'),
@@ -4,7 +4,8 @@ const node_assert_1 = require("node:assert");
4
4
  const node_test_1 = require("node:test");
5
5
  const zod_1 = require("zod");
6
6
  const ant_js_1 = require("./ant.js");
7
- const stub_address = 'valid-address'.padEnd(43, '1');
7
+ const stub_arweave_address = 'valid-address'.padEnd(43, '1');
8
+ const stub_eth_address = '0x8B5f221c8837d862b818799e6b19cc23CE23B0E5';
8
9
  (0, node_test_1.describe)('ANT Schemas', () => {
9
10
  (0, node_test_1.it)('should validate AntStateSchema', () => {
10
11
  const validState = {
@@ -13,18 +14,18 @@ const stub_address = 'valid-address'.padEnd(43, '1');
13
14
  Description: 'Test description',
14
15
  Keywords: ['keyword1', 'keyword2', 'keyword3'],
15
16
  Denomination: 0,
16
- Owner: stub_address,
17
- Controllers: [stub_address],
17
+ Owner: stub_arweave_address,
18
+ Controllers: [stub_arweave_address],
18
19
  Records: {
19
20
  record1: {
20
- transactionId: stub_address,
21
+ transactionId: stub_arweave_address,
21
22
  ttlSeconds: 3600,
22
23
  },
23
24
  },
24
25
  Balances: {
25
- [stub_address]: 1,
26
+ [stub_arweave_address]: 1,
26
27
  },
27
- Logo: stub_address,
28
+ Logo: stub_arweave_address,
28
29
  TotalSupply: 1,
29
30
  Initialized: true,
30
31
  };
@@ -34,8 +35,8 @@ const stub_address = 'valid-address'.padEnd(43, '1');
34
35
  Description: 'Test description',
35
36
  Keywords: ['keyword1', 'keyword2', 'keyword3'],
36
37
  Denomination: 0,
37
- Owner: stub_address,
38
- Controllers: [stub_address],
38
+ Owner: stub_arweave_address,
39
+ Controllers: [stub_arweave_address],
39
40
  Records: {
40
41
  record1: {
41
42
  transactionId: 'invalid-id',
@@ -43,33 +44,57 @@ const stub_address = 'valid-address'.padEnd(43, '1');
43
44
  },
44
45
  },
45
46
  Balances: {
46
- [stub_address]: 1,
47
+ [stub_arweave_address]: 1,
47
48
  },
48
- Logo: stub_address,
49
+ Logo: stub_arweave_address,
49
50
  TotalSupply: -1,
50
51
  Initialized: true,
51
52
  };
52
53
  node_assert_1.strict.doesNotThrow(() => ant_js_1.AntStateSchema.parse(validState));
53
54
  node_assert_1.strict.throws(() => ant_js_1.AntStateSchema.parse(invalidState), zod_1.z.ZodError);
54
55
  });
56
+ (0, node_test_1.it)('should validate AntStateSchema with ETH address', () => {
57
+ const validState = {
58
+ Name: 'TestToken',
59
+ Ticker: 'TST',
60
+ Description: 'Test description',
61
+ Keywords: ['keyword1', 'keyword2', 'keyword3'],
62
+ Denomination: 0,
63
+ Owner: stub_eth_address,
64
+ Controllers: [stub_eth_address],
65
+ Records: {
66
+ record1: {
67
+ transactionId: stub_arweave_address,
68
+ ttlSeconds: 3600,
69
+ },
70
+ },
71
+ Balances: {
72
+ [stub_eth_address]: 1,
73
+ },
74
+ Logo: stub_arweave_address,
75
+ TotalSupply: 1,
76
+ Initialized: true,
77
+ };
78
+ node_assert_1.strict.doesNotThrow(() => ant_js_1.AntStateSchema.parse(validState));
79
+ });
55
80
  (0, node_test_1.it)('should validate AntInfoSchema', () => {
56
81
  const validInfo = {
57
82
  Name: 'TestToken',
58
- Owner: stub_address,
83
+ Owner: stub_arweave_address,
59
84
  Ticker: 'TST',
60
85
  Description: 'Test description',
61
86
  Keywords: ['keyword1', 'keyword2', 'keyword3'],
62
87
  ['Total-Supply']: '1',
63
- Logo: stub_address,
88
+ Logo: stub_arweave_address,
64
89
  Denomination: '0',
65
90
  Handlers: ant_js_1.AntHandlerNames,
66
91
  };
67
92
  const invalidInfo = {
68
93
  Name: 'TestToken',
69
- Owner: stub_address,
94
+ Owner: stub_arweave_address,
70
95
  Ticker: 'TST',
71
96
  ['Total-Supply']: 1000,
72
- Logo: stub_address,
97
+ Logo: stub_arweave_address,
73
98
  Denomination: '1',
74
99
  Handlers: ant_js_1.AntHandlerNames,
75
100
  };
@@ -83,18 +108,18 @@ const stub_address = 'valid-address'.padEnd(43, '1');
83
108
  Description: 'Test description',
84
109
  Keywords: ['keyword1', 'keyword2', 'keyword3'],
85
110
  Denomination: 0,
86
- Owner: stub_address,
87
- Controllers: [stub_address],
111
+ Owner: stub_arweave_address,
112
+ Controllers: [stub_arweave_address],
88
113
  Records: {
89
114
  record1: {
90
- transactionId: stub_address,
115
+ transactionId: stub_arweave_address,
91
116
  ttlSeconds: 3600,
92
117
  },
93
118
  },
94
119
  Balances: {
95
- [stub_address]: 1,
120
+ [stub_arweave_address]: 1,
96
121
  },
97
- Logo: stub_address,
122
+ Logo: stub_arweave_address,
98
123
  TotalSupply: 0,
99
124
  Initialized: true,
100
125
  };
@@ -104,8 +129,8 @@ const stub_address = 'valid-address'.padEnd(43, '1');
104
129
  Description: 'Test description',
105
130
  Keywords: ['keyword1', 'keyword2', 'keyword3'],
106
131
  Denomination: 0,
107
- Owner: stub_address,
108
- Controllers: [stub_address],
132
+ Owner: stub_arweave_address,
133
+ Controllers: [stub_arweave_address],
109
134
  Records: {
110
135
  record1: {
111
136
  transactionId: 'invalid-id',
@@ -113,9 +138,9 @@ const stub_address = 'valid-address'.padEnd(43, '1');
113
138
  },
114
139
  },
115
140
  Balances: {
116
- [stub_address]: 1,
141
+ [stub_arweave_address]: 1,
117
142
  },
118
- Logo: stub_address,
143
+ Logo: stub_arweave_address,
119
144
  TotalSupply: -1,
120
145
  Initialized: true,
121
146
  };
@@ -17,4 +17,4 @@
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.version = void 0;
19
19
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
20
- exports.version = '3.8.2';
20
+ exports.version = '3.8.3';
@@ -34,6 +34,9 @@ export const ArweaveTxIdSchema = z
34
34
  .refine((val) => ARWEAVE_TX_REGEX.test(val), {
35
35
  message: 'Must be an Arweave Transaction ID',
36
36
  });
37
+ export const AOAddressSchema = z.string({
38
+ description: 'AO Address',
39
+ });
37
40
  export const IntegerStringSchema = z
38
41
  .string({
39
42
  description: 'Integer String',
@@ -50,8 +53,8 @@ export const AntRecordSchema = z.object({
50
53
  priority: z.number().optional(),
51
54
  });
52
55
  export const AntRecordsSchema = z.record(z.string(), AntRecordSchema);
53
- export const AntControllersSchema = z.array(ArweaveTxIdSchema.describe('Controller address'));
54
- export const AntBalancesSchema = z.record(ArweaveTxIdSchema.describe('Holder address'), z.number());
56
+ export const AntControllersSchema = z.array(AOAddressSchema.describe('Controller address'));
57
+ export const AntBalancesSchema = z.record(AOAddressSchema.describe('Holder address'), z.number());
55
58
  export const AntStateSchema = z.object({
56
59
  Name: z.string().describe('The name of the ANT.'),
57
60
  Ticker: z.string().describe('The ticker symbol for the ANT.'),
@@ -61,7 +64,7 @@ export const AntStateSchema = z.object({
61
64
  .number()
62
65
  .describe('The number of decimal places to use for the ANT. Defaults to 0 if not set representing whole numbers.')
63
66
  .min(0, { message: 'Denomination must be a non-negative number' }),
64
- Owner: ArweaveTxIdSchema.describe('The Owners address.'),
67
+ Owner: AOAddressSchema.describe('The Owners address.'),
65
68
  Controllers: AntControllersSchema.describe('Controllers of the ANT who have administrative privileges.'),
66
69
  Records: AntRecordsSchema.describe('Records associated with the ANT.'),
67
70
  Balances: AntBalancesSchema.describe('Balance details for each address holding the ANT.'),
@@ -2,7 +2,8 @@ import { strict as assert } from 'node:assert';
2
2
  import { describe, it } from 'node:test';
3
3
  import { z } from 'zod';
4
4
  import { AntHandlerNames, AntInfoSchema, AntStateSchema, isAoANTState, } from './ant.js';
5
- const stub_address = 'valid-address'.padEnd(43, '1');
5
+ const stub_arweave_address = 'valid-address'.padEnd(43, '1');
6
+ const stub_eth_address = '0x8B5f221c8837d862b818799e6b19cc23CE23B0E5';
6
7
  describe('ANT Schemas', () => {
7
8
  it('should validate AntStateSchema', () => {
8
9
  const validState = {
@@ -11,18 +12,18 @@ describe('ANT Schemas', () => {
11
12
  Description: 'Test description',
12
13
  Keywords: ['keyword1', 'keyword2', 'keyword3'],
13
14
  Denomination: 0,
14
- Owner: stub_address,
15
- Controllers: [stub_address],
15
+ Owner: stub_arweave_address,
16
+ Controllers: [stub_arweave_address],
16
17
  Records: {
17
18
  record1: {
18
- transactionId: stub_address,
19
+ transactionId: stub_arweave_address,
19
20
  ttlSeconds: 3600,
20
21
  },
21
22
  },
22
23
  Balances: {
23
- [stub_address]: 1,
24
+ [stub_arweave_address]: 1,
24
25
  },
25
- Logo: stub_address,
26
+ Logo: stub_arweave_address,
26
27
  TotalSupply: 1,
27
28
  Initialized: true,
28
29
  };
@@ -32,8 +33,8 @@ describe('ANT Schemas', () => {
32
33
  Description: 'Test description',
33
34
  Keywords: ['keyword1', 'keyword2', 'keyword3'],
34
35
  Denomination: 0,
35
- Owner: stub_address,
36
- Controllers: [stub_address],
36
+ Owner: stub_arweave_address,
37
+ Controllers: [stub_arweave_address],
37
38
  Records: {
38
39
  record1: {
39
40
  transactionId: 'invalid-id',
@@ -41,33 +42,57 @@ describe('ANT Schemas', () => {
41
42
  },
42
43
  },
43
44
  Balances: {
44
- [stub_address]: 1,
45
+ [stub_arweave_address]: 1,
45
46
  },
46
- Logo: stub_address,
47
+ Logo: stub_arweave_address,
47
48
  TotalSupply: -1,
48
49
  Initialized: true,
49
50
  };
50
51
  assert.doesNotThrow(() => AntStateSchema.parse(validState));
51
52
  assert.throws(() => AntStateSchema.parse(invalidState), z.ZodError);
52
53
  });
54
+ it('should validate AntStateSchema with ETH address', () => {
55
+ const validState = {
56
+ Name: 'TestToken',
57
+ Ticker: 'TST',
58
+ Description: 'Test description',
59
+ Keywords: ['keyword1', 'keyword2', 'keyword3'],
60
+ Denomination: 0,
61
+ Owner: stub_eth_address,
62
+ Controllers: [stub_eth_address],
63
+ Records: {
64
+ record1: {
65
+ transactionId: stub_arweave_address,
66
+ ttlSeconds: 3600,
67
+ },
68
+ },
69
+ Balances: {
70
+ [stub_eth_address]: 1,
71
+ },
72
+ Logo: stub_arweave_address,
73
+ TotalSupply: 1,
74
+ Initialized: true,
75
+ };
76
+ assert.doesNotThrow(() => AntStateSchema.parse(validState));
77
+ });
53
78
  it('should validate AntInfoSchema', () => {
54
79
  const validInfo = {
55
80
  Name: 'TestToken',
56
- Owner: stub_address,
81
+ Owner: stub_arweave_address,
57
82
  Ticker: 'TST',
58
83
  Description: 'Test description',
59
84
  Keywords: ['keyword1', 'keyword2', 'keyword3'],
60
85
  ['Total-Supply']: '1',
61
- Logo: stub_address,
86
+ Logo: stub_arweave_address,
62
87
  Denomination: '0',
63
88
  Handlers: AntHandlerNames,
64
89
  };
65
90
  const invalidInfo = {
66
91
  Name: 'TestToken',
67
- Owner: stub_address,
92
+ Owner: stub_arweave_address,
68
93
  Ticker: 'TST',
69
94
  ['Total-Supply']: 1000,
70
- Logo: stub_address,
95
+ Logo: stub_arweave_address,
71
96
  Denomination: '1',
72
97
  Handlers: AntHandlerNames,
73
98
  };
@@ -81,18 +106,18 @@ describe('ANT Schemas', () => {
81
106
  Description: 'Test description',
82
107
  Keywords: ['keyword1', 'keyword2', 'keyword3'],
83
108
  Denomination: 0,
84
- Owner: stub_address,
85
- Controllers: [stub_address],
109
+ Owner: stub_arweave_address,
110
+ Controllers: [stub_arweave_address],
86
111
  Records: {
87
112
  record1: {
88
- transactionId: stub_address,
113
+ transactionId: stub_arweave_address,
89
114
  ttlSeconds: 3600,
90
115
  },
91
116
  },
92
117
  Balances: {
93
- [stub_address]: 1,
118
+ [stub_arweave_address]: 1,
94
119
  },
95
- Logo: stub_address,
120
+ Logo: stub_arweave_address,
96
121
  TotalSupply: 0,
97
122
  Initialized: true,
98
123
  };
@@ -102,8 +127,8 @@ describe('ANT Schemas', () => {
102
127
  Description: 'Test description',
103
128
  Keywords: ['keyword1', 'keyword2', 'keyword3'],
104
129
  Denomination: 0,
105
- Owner: stub_address,
106
- Controllers: [stub_address],
130
+ Owner: stub_arweave_address,
131
+ Controllers: [stub_arweave_address],
107
132
  Records: {
108
133
  record1: {
109
134
  transactionId: 'invalid-id',
@@ -111,9 +136,9 @@ describe('ANT Schemas', () => {
111
136
  },
112
137
  },
113
138
  Balances: {
114
- [stub_address]: 1,
139
+ [stub_arweave_address]: 1,
115
140
  },
116
- Logo: stub_address,
141
+ Logo: stub_arweave_address,
117
142
  TotalSupply: -1,
118
143
  Initialized: true,
119
144
  };
@@ -14,4 +14,4 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
17
- export const version = '3.8.2';
17
+ export const version = '3.8.3';
@@ -28,6 +28,7 @@ import { AoWriteAction, WalletAddress } from './common.js';
28
28
  },
29
29
  */
30
30
  export declare const ArweaveTxIdSchema: z.ZodEffects<z.ZodString, string, string>;
31
+ export declare const AOAddressSchema: z.ZodString;
31
32
  export declare const IntegerStringSchema: z.ZodEffects<z.ZodString, string, string>;
32
33
  export declare const AntDescriptionSchema: z.ZodString;
33
34
  export declare const AntKeywordsSchema: z.ZodArray<z.ZodString, "many">;
@@ -63,16 +64,16 @@ export declare const AntRecordsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
63
64
  ttlSeconds: number;
64
65
  priority?: number | undefined;
65
66
  }>>;
66
- export declare const AntControllersSchema: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
67
- export declare const AntBalancesSchema: z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodNumber>;
67
+ export declare const AntControllersSchema: z.ZodArray<z.ZodString, "many">;
68
+ export declare const AntBalancesSchema: z.ZodRecord<z.ZodString, z.ZodNumber>;
68
69
  export declare const AntStateSchema: z.ZodObject<{
69
70
  Name: z.ZodString;
70
71
  Ticker: z.ZodString;
71
72
  Description: z.ZodString;
72
73
  Keywords: z.ZodArray<z.ZodString, "many">;
73
74
  Denomination: z.ZodNumber;
74
- Owner: z.ZodEffects<z.ZodString, string, string>;
75
- Controllers: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
75
+ Owner: z.ZodString;
76
+ Controllers: z.ZodArray<z.ZodString, "many">;
76
77
  Records: z.ZodRecord<z.ZodString, z.ZodObject<{
77
78
  transactionId: z.ZodEffects<z.ZodString, string, string>;
78
79
  ttlSeconds: z.ZodNumber;
@@ -86,7 +87,7 @@ export declare const AntStateSchema: z.ZodObject<{
86
87
  ttlSeconds: number;
87
88
  priority?: number | undefined;
88
89
  }>>;
89
- Balances: z.ZodRecord<z.ZodEffects<z.ZodString, string, string>, z.ZodNumber>;
90
+ Balances: z.ZodRecord<z.ZodString, z.ZodNumber>;
90
91
  Logo: z.ZodEffects<z.ZodString, string, string>;
91
92
  TotalSupply: z.ZodNumber;
92
93
  Initialized: z.ZodBoolean;
@@ -391,6 +391,7 @@ export type AoGatewayRegistrySettings = {
391
391
  minStake: number;
392
392
  withdrawLengthMs: number;
393
393
  leaveLengthMs: number;
394
+ maxDelegateRewardSharePct: number;
394
395
  failedEpochCountMax: number;
395
396
  failedGatewaySlashRate: number;
396
397
  };
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare const version = "3.8.2-alpha.1";
16
+ export declare const version = "3.8.3-alpha.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "3.8.2",
3
+ "version": "3.8.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"