@ar.io/sdk 3.8.1 → 3.8.2-alpha.2

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.
@@ -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.1';
17
+ export const version = '3.8.2-alpha.2';
@@ -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;
@@ -113,3 +113,15 @@ export interface AOContract {
113
113
  }
114
114
  /** utility type to ensure WriteOptions are appended to each parameter set */
115
115
  export type AoWriteAction<P, R = AoMessageResult> = (params: P, options?: WriteOptions) => Promise<R>;
116
+ export type DryRunResult = {
117
+ Output: any;
118
+ Messages: any[];
119
+ Spawns: any[];
120
+ Error?: any;
121
+ };
122
+ export type MessageResult = {
123
+ Output: any;
124
+ Messages: any[];
125
+ Spawns: any[];
126
+ Error?: any;
127
+ };
@@ -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.0";
16
+ export declare const version = "3.8.2-alpha.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "3.8.1",
3
+ "version": "3.8.2-alpha.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"