@ar.io/sdk 2.0.0-alpha.7 → 2.0.0-alpha.9

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.
@@ -52,7 +52,12 @@ class IOReadable {
52
52
  {
53
53
  name: 'Timestamp',
54
54
  value: params?.timestamp?.toString() ??
55
- (await this.arweave.blocks.getCurrent().catch(() => {
55
+ (await this.arweave.blocks
56
+ .getCurrent()
57
+ .then((block) => {
58
+ return { timestamp: block.timestamp * 1000 };
59
+ })
60
+ .catch(() => {
56
61
  return { timestamp: Date.now() }; // fallback to current time
57
62
  })).timestamp.toString(),
58
63
  },
@@ -72,7 +77,12 @@ class IOReadable {
72
77
  {
73
78
  name: 'Timestamp',
74
79
  value: epoch?.timestamp?.toString() ??
75
- (await this.arweave.blocks.getCurrent().catch(() => {
80
+ (await this.arweave.blocks
81
+ .getCurrent()
82
+ .then((block) => {
83
+ return { timestamp: block.timestamp * 1000 };
84
+ })
85
+ .catch(() => {
76
86
  return { timestamp: Date.now() }; // fallback to current time
77
87
  })).timestamp.toString(),
78
88
  },
@@ -144,7 +154,12 @@ class IOReadable {
144
154
  { name: 'Action', value: 'Epoch' },
145
155
  {
146
156
  name: 'Timestamp',
147
- value: (await this.arweave.blocks.getCurrent().catch(() => {
157
+ value: (await this.arweave.blocks
158
+ .getCurrent()
159
+ .then((block) => {
160
+ return { timestamp: block.timestamp * 1000 };
161
+ })
162
+ .catch(() => {
148
163
  return { timestamp: Date.now() }; // fallback to current time
149
164
  })).timestamp.toString(),
150
165
  },
@@ -157,7 +172,12 @@ class IOReadable {
157
172
  {
158
173
  name: 'Timestamp',
159
174
  value: epoch?.timestamp?.toString() ??
160
- (await this.arweave.blocks.getCurrent().catch(() => {
175
+ (await this.arweave.blocks
176
+ .getCurrent()
177
+ .then((block) => {
178
+ return { timestamp: block.timestamp * 1000 };
179
+ })
180
+ .catch(() => {
161
181
  return { timestamp: Date.now() }; // fallback to current time
162
182
  })).timestamp.toString(),
163
183
  },
@@ -177,7 +197,12 @@ class IOReadable {
177
197
  {
178
198
  name: 'Timestamp',
179
199
  value: epoch?.timestamp?.toString() ??
180
- (await this.arweave.blocks.getCurrent().catch(() => {
200
+ (await this.arweave.blocks
201
+ .getCurrent()
202
+ .then((block) => {
203
+ return { timestamp: block.timestamp * 1000 };
204
+ })
205
+ .catch(() => {
181
206
  return { timestamp: Date.now() }; // fallback to current time
182
207
  })).timestamp.toString(),
183
208
  },
@@ -197,7 +222,12 @@ class IOReadable {
197
222
  {
198
223
  name: 'Timestamp',
199
224
  value: epoch?.timestamp?.toString() ??
200
- (await this.arweave.blocks.getCurrent().catch(() => {
225
+ (await this.arweave.blocks
226
+ .getCurrent()
227
+ .then((block) => {
228
+ return { timestamp: block.timestamp * 1000 };
229
+ })
230
+ .catch(() => {
201
231
  return { timestamp: `${Date.now()}` }; // fallback to current time
202
232
  })).timestamp.toString(),
203
233
  },
@@ -217,7 +247,12 @@ class IOReadable {
217
247
  {
218
248
  name: 'Timestamp',
219
249
  value: epoch?.timestamp?.toString() ??
220
- (await this.arweave.blocks.getCurrent().catch(() => {
250
+ (await this.arweave.blocks
251
+ .getCurrent()
252
+ .then((block) => {
253
+ return { timestamp: block.timestamp * 1000 };
254
+ })
255
+ .catch(() => {
221
256
  return { timestamp: Date.now() }; // fallback to current time
222
257
  })).timestamp.toString(),
223
258
  },
@@ -256,7 +291,12 @@ class IOReadable {
256
291
  },
257
292
  {
258
293
  name: 'Timestamp',
259
- value: (await this.arweave.blocks.getCurrent().catch(() => {
294
+ value: (await this.arweave.blocks
295
+ .getCurrent()
296
+ .then((block) => {
297
+ return { timestamp: block.timestamp * 1000 };
298
+ })
299
+ .catch(() => {
260
300
  return { timestamp: Date.now() }; // fallback to current time
261
301
  })).timestamp.toString(),
262
302
  },
@@ -373,6 +413,13 @@ class IOWriteable extends IOReadable {
373
413
  tags: prunedTags,
374
414
  });
375
415
  }
416
+ async leaveNetwork(options) {
417
+ const { tags = [] } = options || {};
418
+ return this.process.send({
419
+ signer: this.signer,
420
+ tags: [...tags, { name: 'Action', value: 'Leave-Network' }],
421
+ });
422
+ }
376
423
  async updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }, options) {
377
424
  const { tags = [] } = options || {};
378
425
  const allTags = [
@@ -18,4 +18,4 @@
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.version = void 0;
20
20
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
21
- exports.version = '2.0.0-alpha.7';
21
+ exports.version = '2.0.0-alpha.9';
@@ -48,7 +48,12 @@ export class IOReadable {
48
48
  {
49
49
  name: 'Timestamp',
50
50
  value: params?.timestamp?.toString() ??
51
- (await this.arweave.blocks.getCurrent().catch(() => {
51
+ (await this.arweave.blocks
52
+ .getCurrent()
53
+ .then((block) => {
54
+ return { timestamp: block.timestamp * 1000 };
55
+ })
56
+ .catch(() => {
52
57
  return { timestamp: Date.now() }; // fallback to current time
53
58
  })).timestamp.toString(),
54
59
  },
@@ -68,7 +73,12 @@ export class IOReadable {
68
73
  {
69
74
  name: 'Timestamp',
70
75
  value: epoch?.timestamp?.toString() ??
71
- (await this.arweave.blocks.getCurrent().catch(() => {
76
+ (await this.arweave.blocks
77
+ .getCurrent()
78
+ .then((block) => {
79
+ return { timestamp: block.timestamp * 1000 };
80
+ })
81
+ .catch(() => {
72
82
  return { timestamp: Date.now() }; // fallback to current time
73
83
  })).timestamp.toString(),
74
84
  },
@@ -140,7 +150,12 @@ export class IOReadable {
140
150
  { name: 'Action', value: 'Epoch' },
141
151
  {
142
152
  name: 'Timestamp',
143
- value: (await this.arweave.blocks.getCurrent().catch(() => {
153
+ value: (await this.arweave.blocks
154
+ .getCurrent()
155
+ .then((block) => {
156
+ return { timestamp: block.timestamp * 1000 };
157
+ })
158
+ .catch(() => {
144
159
  return { timestamp: Date.now() }; // fallback to current time
145
160
  })).timestamp.toString(),
146
161
  },
@@ -153,7 +168,12 @@ export class IOReadable {
153
168
  {
154
169
  name: 'Timestamp',
155
170
  value: epoch?.timestamp?.toString() ??
156
- (await this.arweave.blocks.getCurrent().catch(() => {
171
+ (await this.arweave.blocks
172
+ .getCurrent()
173
+ .then((block) => {
174
+ return { timestamp: block.timestamp * 1000 };
175
+ })
176
+ .catch(() => {
157
177
  return { timestamp: Date.now() }; // fallback to current time
158
178
  })).timestamp.toString(),
159
179
  },
@@ -173,7 +193,12 @@ export class IOReadable {
173
193
  {
174
194
  name: 'Timestamp',
175
195
  value: epoch?.timestamp?.toString() ??
176
- (await this.arweave.blocks.getCurrent().catch(() => {
196
+ (await this.arweave.blocks
197
+ .getCurrent()
198
+ .then((block) => {
199
+ return { timestamp: block.timestamp * 1000 };
200
+ })
201
+ .catch(() => {
177
202
  return { timestamp: Date.now() }; // fallback to current time
178
203
  })).timestamp.toString(),
179
204
  },
@@ -193,7 +218,12 @@ export class IOReadable {
193
218
  {
194
219
  name: 'Timestamp',
195
220
  value: epoch?.timestamp?.toString() ??
196
- (await this.arweave.blocks.getCurrent().catch(() => {
221
+ (await this.arweave.blocks
222
+ .getCurrent()
223
+ .then((block) => {
224
+ return { timestamp: block.timestamp * 1000 };
225
+ })
226
+ .catch(() => {
197
227
  return { timestamp: `${Date.now()}` }; // fallback to current time
198
228
  })).timestamp.toString(),
199
229
  },
@@ -213,7 +243,12 @@ export class IOReadable {
213
243
  {
214
244
  name: 'Timestamp',
215
245
  value: epoch?.timestamp?.toString() ??
216
- (await this.arweave.blocks.getCurrent().catch(() => {
246
+ (await this.arweave.blocks
247
+ .getCurrent()
248
+ .then((block) => {
249
+ return { timestamp: block.timestamp * 1000 };
250
+ })
251
+ .catch(() => {
217
252
  return { timestamp: Date.now() }; // fallback to current time
218
253
  })).timestamp.toString(),
219
254
  },
@@ -252,7 +287,12 @@ export class IOReadable {
252
287
  },
253
288
  {
254
289
  name: 'Timestamp',
255
- value: (await this.arweave.blocks.getCurrent().catch(() => {
290
+ value: (await this.arweave.blocks
291
+ .getCurrent()
292
+ .then((block) => {
293
+ return { timestamp: block.timestamp * 1000 };
294
+ })
295
+ .catch(() => {
256
296
  return { timestamp: Date.now() }; // fallback to current time
257
297
  })).timestamp.toString(),
258
298
  },
@@ -368,6 +408,13 @@ export class IOWriteable extends IOReadable {
368
408
  tags: prunedTags,
369
409
  });
370
410
  }
411
+ async leaveNetwork(options) {
412
+ const { tags = [] } = options || {};
413
+ return this.process.send({
414
+ signer: this.signer,
415
+ tags: [...tags, { name: 'Action', value: 'Leave-Network' }],
416
+ });
417
+ }
371
418
  async updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }, options) {
372
419
  const { tags = [] } = options || {};
373
420
  const allTags = [
@@ -15,4 +15,4 @@
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
  // AUTOMATICALLY GENERATED FILE - DO NOT TOUCH
18
- export const version = '2.0.0-alpha.7';
18
+ export const version = '2.0.0-alpha.9';
@@ -105,6 +105,7 @@ export declare class IOWriteable extends IOReadable implements AoIOWrite {
105
105
  observerAddress: string;
106
106
  operatorStake: number | mIOToken;
107
107
  }, options?: WriteOptions): Promise<AoMessageResult>;
108
+ leaveNetwork(options?: WriteOptions): Promise<AoMessageResult>;
108
109
  updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: Omit<UpdateGatewaySettingsParams, 'observerWallet'> & {
109
110
  observerAddress: string;
110
111
  }, options?: WriteOptions): Promise<AoMessageResult>;
package/lib/types/io.d.ts CHANGED
@@ -102,6 +102,7 @@ export interface AoIOWrite extends AoIORead {
102
102
  observerAddress: string;
103
103
  operatorStake: number | mIOToken;
104
104
  }, options?: WriteOptions): Promise<AoMessageResult>;
105
+ leaveNetwork(options?: WriteOptions): Promise<AoMessageResult>;
105
106
  updateGatewaySettings({ allowDelegatedStaking, delegateRewardShareRatio, fqdn, label, minDelegatedStake, note, port, properties, protocol, autoStake, observerAddress, }: Omit<UpdateGatewaySettingsParams, 'observerWallet'> & {
106
107
  observerAddress?: WalletAddress;
107
108
  }, options?: WriteOptions): Promise<AoMessageResult>;
@@ -14,4 +14,4 @@
14
14
  * You should have received a copy of the GNU Affero General Public License
15
15
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
- export declare const version = "2.0.0-alpha.6";
17
+ export declare const version = "2.0.0-alpha.8";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ar.io/sdk",
3
- "version": "2.0.0-alpha.7",
3
+ "version": "2.0.0-alpha.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ar-io/ar-io-sdk.git"