@ar.io/sdk 3.1.0-alpha.3 → 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.
- package/bundles/web.bundle.min.js +2 -2
- package/lib/cjs/common/contracts/ao-process.js +10 -4
- package/lib/cjs/version.js +1 -1
- package/lib/esm/common/contracts/ao-process.js +10 -4
- package/lib/esm/version.js +1 -1
- package/lib/types/common/contracts/ao-process.d.ts +1 -0
- package/lib/types/common/io.d.ts +1 -1
- package/lib/types/version.d.ts +1 -1
- package/package.json +2 -2
|
@@ -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
|
|
66
|
-
if (messageData
|
|
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
|
|
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);
|
package/lib/cjs/version.js
CHANGED
|
@@ -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
|
|
63
|
-
if (messageData
|
|
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
|
|
139
|
+
if (this.isMessageDataEmpty(output.Messages[0].Data)) {
|
|
134
140
|
return { id: messageId };
|
|
135
141
|
}
|
|
136
142
|
const resultData = safeDecode(output.Messages[0].Data);
|
package/lib/esm/version.js
CHANGED
package/lib/types/common/io.d.ts
CHANGED
|
@@ -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;
|
package/lib/types/version.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ar.io/sdk",
|
|
3
|
-
"version": "3.1.0-alpha.
|
|
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.
|
|
130
|
+
"axios": "1.7.9",
|
|
131
131
|
"axios-retry": "^4.3.0",
|
|
132
132
|
"commander": "^12.1.0",
|
|
133
133
|
"eventemitter3": "^5.0.1",
|