@ar.io/sdk 3.1.0-alpha.2 → 3.1.0-alpha.4

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.
@@ -31,6 +31,12 @@ class AOProcess {
31
31
  this.logger = logger;
32
32
  this.ao = ao;
33
33
  }
34
+ isMessageDataEmpty(messageData) {
35
+ return (messageData === undefined ||
36
+ messageData === 'null' || // This is what the CU returns for 'nil' values that are json.encoded
37
+ messageData === '' ||
38
+ messageData === null);
39
+ }
34
40
  async read({ tags, retries = 3, fromAddress, }) {
35
41
  let attempts = 0;
36
42
  let lastError;
@@ -62,9 +68,9 @@ class AOProcess {
62
68
  if (error) {
63
69
  throw new Error(`${error}${messageData ? `: ${messageData}` : ''}`);
64
70
  }
65
- // return empty object if no data is returned
66
- if (messageData === undefined) {
67
- return {};
71
+ // return undefined if no data is returned
72
+ if (this.isMessageDataEmpty(messageData)) {
73
+ return undefined;
68
74
  }
69
75
  const response = (0, json_js_1.safeDecode)(result.Messages[0].Data);
70
76
  return response;
@@ -133,7 +139,7 @@ class AOProcess {
133
139
  if (output.Messages.length === 0) {
134
140
  throw new Error(`Process ${this.processId} does not support provided action.`);
135
141
  }
136
- if (output.Messages[0].Data === undefined) {
142
+ if (this.isMessageDataEmpty(output.Messages[0].Data)) {
137
143
  return { id: messageId };
138
144
  }
139
145
  const resultData = (0, json_js_1.safeDecode)(output.Messages[0].Data);
@@ -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.1.0-alpha.2';
20
+ exports.version = '3.1.0-alpha.4';
@@ -28,6 +28,12 @@ export class AOProcess {
28
28
  this.logger = logger;
29
29
  this.ao = ao;
30
30
  }
31
+ isMessageDataEmpty(messageData) {
32
+ return (messageData === undefined ||
33
+ messageData === 'null' || // This is what the CU returns for 'nil' values that are json.encoded
34
+ messageData === '' ||
35
+ messageData === null);
36
+ }
31
37
  async read({ tags, retries = 3, fromAddress, }) {
32
38
  let attempts = 0;
33
39
  let lastError;
@@ -59,9 +65,9 @@ export class AOProcess {
59
65
  if (error) {
60
66
  throw new Error(`${error}${messageData ? `: ${messageData}` : ''}`);
61
67
  }
62
- // return empty object if no data is returned
63
- if (messageData === undefined) {
64
- return {};
68
+ // return undefined if no data is returned
69
+ if (this.isMessageDataEmpty(messageData)) {
70
+ return undefined;
65
71
  }
66
72
  const response = safeDecode(result.Messages[0].Data);
67
73
  return response;
@@ -130,7 +136,7 @@ export class AOProcess {
130
136
  if (output.Messages.length === 0) {
131
137
  throw new Error(`Process ${this.processId} does not support provided action.`);
132
138
  }
133
- if (output.Messages[0].Data === undefined) {
139
+ if (this.isMessageDataEmpty(output.Messages[0].Data)) {
134
140
  return { id: messageId };
135
141
  }
136
142
  const resultData = safeDecode(output.Messages[0].Data);
@@ -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.1.0-alpha.2';
17
+ export const version = '3.1.0-alpha.4';
@@ -9,6 +9,7 @@ export declare class AOProcess implements AOContract {
9
9
  ao?: AoClient;
10
10
  logger?: ILogger;
11
11
  });
12
+ private isMessageDataEmpty;
12
13
  read<K>({ tags, retries, fromAddress, }: {
13
14
  tags?: Array<{
14
15
  name: string;
@@ -27,7 +27,7 @@ export declare class ARIO {
27
27
  process: AOProcess;
28
28
  }>): AoARIOWrite;
29
29
  static init({ processId, signer, }: WithSigner<{
30
- processId: string;
30
+ processId?: string;
31
31
  }>): AoARIOWrite;
32
32
  static init({ processId, signer, }: {
33
33
  signer?: ContractSigner | undefined;
@@ -67,7 +67,7 @@ export declare class ARIOReadable implements AoARIORead {
67
67
  getVault({ address, vaultId, }: {
68
68
  address: WalletAddress;
69
69
  vaultId: string;
70
- }): Promise<AoVaultData>;
70
+ }): Promise<AoVaultData | undefined>;
71
71
  getVaults(params?: PaginationParams<AoWalletVault>): Promise<PaginationResult<AoWalletVault>>;
72
72
  getGateway({ address, }: {
73
73
  address: WalletAddress;
@@ -125,7 +125,7 @@ export declare class ARIOReadable implements AoARIORead {
125
125
  getPrimaryNameRequest(params: {
126
126
  initiator: WalletAddress;
127
127
  }): Promise<AoPrimaryNameRequest>;
128
- getPrimaryNameRequests(params: PaginationParams<AoPrimaryNameRequest>): Promise<PaginationResult<AoPrimaryNameRequest>>;
128
+ getPrimaryNameRequests(params?: PaginationParams<AoPrimaryNameRequest>): Promise<PaginationResult<AoPrimaryNameRequest>>;
129
129
  getPrimaryName(params: {
130
130
  address: WalletAddress;
131
131
  } | {
@@ -52,6 +52,7 @@ export type AoPrimaryNameRequest = {
52
52
  };
53
53
  export type AoPrimaryName = {
54
54
  owner: WalletAddress;
55
+ processId: ProcessId;
55
56
  name: string;
56
57
  startTimestamp: Timestamp;
57
58
  };
@@ -25,6 +25,7 @@ export type PaginationParams<T = Record<string, never>> = {
25
25
  export type PaginationResult<T> = {
26
26
  items: T[];
27
27
  nextCursor?: string;
28
+ limit: number;
28
29
  totalItems: number;
29
30
  sortBy?: T extends string ? string : keyof T;
30
31
  sortOrder: 'asc' | 'desc';
@@ -392,7 +393,7 @@ export interface AoARIORead {
392
393
  getPrimaryNameRequest(params: {
393
394
  initiator: WalletAddress;
394
395
  }): Promise<AoPrimaryNameRequest>;
395
- getPrimaryNameRequests(params: PaginationParams<AoPrimaryNameRequest>): Promise<PaginationResult<AoPrimaryNameRequest>>;
396
+ getPrimaryNameRequests(params?: PaginationParams<AoPrimaryNameRequest>): Promise<PaginationResult<AoPrimaryNameRequest>>;
396
397
  getPrimaryName(params: {
397
398
  address: WalletAddress;
398
399
  } | {
@@ -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.1.0-alpha.1";
16
+ export declare const version = "3.1.0-alpha.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "3.1.0-alpha.2",
3
+ "version": "3.1.0-alpha.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"
@@ -127,7 +127,7 @@
127
127
  "@dha-team/arbundles": "^1.0.1",
128
128
  "@permaweb/aoconnect": "^0.0.57",
129
129
  "arweave": "1.14.4",
130
- "axios": "1.7.8",
130
+ "axios": "1.7.9",
131
131
  "axios-retry": "^4.3.0",
132
132
  "commander": "^12.1.0",
133
133
  "eventemitter3": "^5.0.1",