@across-protocol/sdk 4.3.143-alpha.3 → 4.3.143
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/dist/cjs/src/caching/Arweave/ArweaveClient.d.ts +6 -11
- package/dist/cjs/src/caching/Arweave/ArweaveClient.js +74 -98
- package/dist/cjs/src/caching/Arweave/ArweaveClient.js.map +1 -1
- package/dist/cjs/src/clients/BundleDataClient/utils/SuperstructUtils.d.ts +64 -63
- package/dist/cjs/src/clients/BundleDataClient/utils/SuperstructUtils.js +31 -13
- package/dist/cjs/src/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/esm/src/caching/Arweave/ArweaveClient.d.ts +8 -21
- package/dist/esm/src/caching/Arweave/ArweaveClient.js +80 -113
- package/dist/esm/src/caching/Arweave/ArweaveClient.js.map +1 -1
- package/dist/esm/src/clients/BundleDataClient/utils/SuperstructUtils.d.ts +64 -63
- package/dist/esm/src/clients/BundleDataClient/utils/SuperstructUtils.js +29 -11
- package/dist/esm/src/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/types/src/caching/Arweave/ArweaveClient.d.ts +8 -21
- package/dist/types/src/caching/Arweave/ArweaveClient.d.ts.map +1 -1
- package/dist/types/src/clients/BundleDataClient/utils/SuperstructUtils.d.ts +64 -63
- package/dist/types/src/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/caching/Arweave/ArweaveClient.ts +76 -126
- package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +26 -12
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BundleDataSS = exports.SortableEventSS = void 0;
|
|
3
|
+
exports.BundleDataSS = exports.SortableEventSS = exports.AddressType = void 0;
|
|
4
4
|
const superstruct_1 = require("superstruct");
|
|
5
|
+
const ethers_1 = require("ethers");
|
|
6
|
+
const viem_1 = require("viem");
|
|
7
|
+
const kit_1 = require("@solana/kit");
|
|
8
|
+
const tronweb_1 = require("tronweb");
|
|
5
9
|
const constants_1 = require("../../../constants");
|
|
6
10
|
const utils_1 = require("../../../utils");
|
|
7
11
|
const PositiveIntegerStringSS = (0, superstruct_1.pattern)((0, superstruct_1.string)(), /\d+/);
|
|
@@ -14,26 +18,40 @@ const BigNumberType = (0, superstruct_1.coerce)((0, superstruct_1.instance)(util
|
|
|
14
18
|
return value;
|
|
15
19
|
}
|
|
16
20
|
});
|
|
17
|
-
const AddressInstanceSS = (0, superstruct_1.union)([
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
const AddressInstanceSS = (0, superstruct_1.union)([
|
|
22
|
+
(0, superstruct_1.instance)(utils_1.EvmAddress),
|
|
23
|
+
(0, superstruct_1.instance)(utils_1.SvmAddress),
|
|
24
|
+
(0, superstruct_1.instance)(utils_1.TvmAddress),
|
|
25
|
+
(0, superstruct_1.instance)(utils_1.RawAddress),
|
|
26
|
+
]);
|
|
27
|
+
exports.AddressType = (0, superstruct_1.coerce)(AddressInstanceSS, (0, superstruct_1.string)(), (value) => {
|
|
28
|
+
try {
|
|
29
|
+
if (value.length === 42 && (0, viem_1.isAddress)(value, { strict: false }))
|
|
30
|
+
return utils_1.EvmAddress.from(value);
|
|
31
|
+
if (value.length === 34 && tronweb_1.TronWeb.isAddress(value))
|
|
32
|
+
return utils_1.TvmAddress.from(value);
|
|
33
|
+
if ((0, kit_1.isAddress)(value))
|
|
34
|
+
return utils_1.SvmAddress.from(value);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
}
|
|
38
|
+
return new utils_1.RawAddress(value.startsWith("0x") ? ethers_1.utils.arrayify(value) : utils_1.bs58.decode(value));
|
|
21
39
|
});
|
|
22
40
|
const Web3AddressType = (0, superstruct_1.coerce)(Web3AddressSS, (0, superstruct_1.string)(), (value) => {
|
|
23
41
|
return (0, utils_1.toBytes32)(value);
|
|
24
42
|
});
|
|
25
43
|
const FillTypeSS = (0, superstruct_1.number)();
|
|
26
44
|
const V3RelayDataSS = {
|
|
27
|
-
inputToken: AddressType,
|
|
45
|
+
inputToken: exports.AddressType,
|
|
28
46
|
inputAmount: BigNumberType,
|
|
29
|
-
outputToken: AddressType,
|
|
47
|
+
outputToken: exports.AddressType,
|
|
30
48
|
outputAmount: BigNumberType,
|
|
31
49
|
fillDeadline: (0, superstruct_1.number)(),
|
|
32
|
-
exclusiveRelayer: AddressType,
|
|
50
|
+
exclusiveRelayer: exports.AddressType,
|
|
33
51
|
exclusivityDeadline: (0, superstruct_1.number)(),
|
|
34
52
|
originChainId: (0, superstruct_1.number)(),
|
|
35
|
-
depositor: AddressType,
|
|
36
|
-
recipient: AddressType,
|
|
53
|
+
depositor: exports.AddressType,
|
|
54
|
+
recipient: exports.AddressType,
|
|
37
55
|
depositId: BigNumberType,
|
|
38
56
|
message: (0, superstruct_1.string)(),
|
|
39
57
|
};
|
|
@@ -53,7 +71,7 @@ const V3DepositSS = {
|
|
|
53
71
|
quoteTimestamp: (0, superstruct_1.number)(),
|
|
54
72
|
relayerFeePct: (0, superstruct_1.optional)(BigNumberType),
|
|
55
73
|
speedUpSignature: (0, superstruct_1.optional)((0, superstruct_1.string)()),
|
|
56
|
-
updatedRecipient: (0, superstruct_1.optional)(AddressType),
|
|
74
|
+
updatedRecipient: (0, superstruct_1.optional)(exports.AddressType),
|
|
57
75
|
updatedOutputAmount: (0, superstruct_1.optional)(BigNumberType),
|
|
58
76
|
updatedMessage: (0, superstruct_1.optional)((0, superstruct_1.string)()),
|
|
59
77
|
};
|
|
@@ -71,7 +89,7 @@ const V3DepositWithBlockLpFeeSS = (0, superstruct_1.object)({
|
|
|
71
89
|
const V3RelayExecutionEventInfoSS = (0, superstruct_1.object)({
|
|
72
90
|
updatedOutputAmount: BigNumberType,
|
|
73
91
|
fillType: FillTypeSS,
|
|
74
|
-
updatedRecipient: AddressType,
|
|
92
|
+
updatedRecipient: exports.AddressType,
|
|
75
93
|
updatedMessage: (0, superstruct_1.optional)((0, superstruct_1.string)()),
|
|
76
94
|
updatedMessageHash: (0, superstruct_1.defaulted)((0, superstruct_1.string)(), constants_1.UNDEFINED_MESSAGE_HASH),
|
|
77
95
|
});
|
|
@@ -80,7 +98,7 @@ const V3FillSS = {
|
|
|
80
98
|
message: (0, superstruct_1.optional)((0, superstruct_1.string)()),
|
|
81
99
|
messageHash: (0, superstruct_1.defaulted)((0, superstruct_1.string)(), constants_1.UNDEFINED_MESSAGE_HASH),
|
|
82
100
|
destinationChainId: (0, superstruct_1.number)(),
|
|
83
|
-
relayer: AddressType,
|
|
101
|
+
relayer: exports.AddressType,
|
|
84
102
|
repaymentChainId: (0, superstruct_1.number)(),
|
|
85
103
|
relayExecutionInfo: V3RelayExecutionEventInfoSS,
|
|
86
104
|
quoteTimestamp: (0, superstruct_1.number)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuperstructUtils.js","sourceRoot":"","sources":["../../../../../../src/clients/BundleDataClient/utils/SuperstructUtils.ts"],"names":[],"mappings":";;;AAAA,6CAeqB;AACrB,
|
|
1
|
+
{"version":3,"file":"SuperstructUtils.js","sourceRoot":"","sources":["../../../../../../src/clients/BundleDataClient/utils/SuperstructUtils.ts"],"names":[],"mappings":";;;AAAA,6CAeqB;AACrB,mCAA8C;AAC9C,+BAAsD;AACtD,qCAA6D;AAC7D,qCAAkC;AAClC,kDAA4D;AAC5D,0CAA4G;AAE5G,MAAM,uBAAuB,GAAG,IAAA,qBAAO,EAAC,IAAA,oBAAM,GAAE,EAAE,KAAK,CAAC,CAAC;AACzD,MAAM,aAAa,GAAG,IAAA,qBAAO,EAAC,IAAA,oBAAM,GAAE,EAAE,qBAAqB,CAAC,CAAC;AAE/D,MAAM,aAAa,GAAG,IAAA,oBAAM,EAAC,IAAA,sBAAQ,EAAC,iBAAS,CAAC,EAAE,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE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"winston";
|
|
4
4
|
import { BigNumber } from "../../utils";
|
|
5
|
-
export interface ArweaveGatewayConfig {
|
|
6
|
-
host: string;
|
|
7
|
-
protocol?: string;
|
|
8
|
-
port?: number;
|
|
9
|
-
}
|
|
10
|
-
export declare const DEFAULT_ARWEAVE_GATEWAYS: ArweaveGatewayConfig[];
|
|
11
5
|
export declare class ArweaveClient {
|
|
12
6
|
private arweaveJWT;
|
|
13
7
|
private logger;
|
|
8
|
+
gatewayURL: string;
|
|
9
|
+
protocol: string;
|
|
14
10
|
private readonly retries;
|
|
15
11
|
private readonly retryDelaySeconds;
|
|
16
|
-
private
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* Races a request across all gateways, returning the first successful response.
|
|
20
|
-
* If all gateways fail, throws an error with details from each gateway.
|
|
21
|
-
*/
|
|
22
|
-
private _raceGateways;
|
|
23
|
-
/**
|
|
24
|
-
* Tries gateways sequentially, returning the first successful response.
|
|
25
|
-
* Used for write operations where we want exactly one successful submission.
|
|
26
|
-
*/
|
|
27
|
-
private _failoverGateways;
|
|
28
|
-
private _retryRequest;
|
|
12
|
+
private client;
|
|
13
|
+
private gatewayUrl;
|
|
14
|
+
constructor(arweaveJWT: JWKInterface, logger: winston.Logger, gatewayURL?: string, protocol?: string, port?: number, retries?: number, retryDelaySeconds?: number);
|
|
29
15
|
/**
|
|
30
16
|
* Stores an arbitrary record in the Arweave network. The record is stored as a JSON string and uses
|
|
31
17
|
* JSON.stringify to convert the record to a string. The record has all of its big numbers converted
|
|
@@ -33,6 +19,7 @@ export declare class ArweaveClient {
|
|
|
33
19
|
* @param value The value to store
|
|
34
20
|
* @param topicTag An optional topic tag to add to the transaction
|
|
35
21
|
* @returns The transaction ID of the stored value
|
|
22
|
+
* @
|
|
36
23
|
*/
|
|
37
24
|
set(value: Record<string, unknown>, topicTag?: string | undefined): Promise<string | undefined>;
|
|
38
25
|
/**
|
|
@@ -66,11 +53,11 @@ export declare class ArweaveClient {
|
|
|
66
53
|
*/
|
|
67
54
|
getMetadata(transactionID: string): Promise<Record<string, string> | null>;
|
|
68
55
|
/**
|
|
69
|
-
* Returns the address of the signer of the JWT
|
|
70
|
-
* operation and does not require a network call.
|
|
56
|
+
* Returns the address of the signer of the JWT
|
|
71
57
|
* @returns The address of the signer in this client
|
|
72
58
|
*/
|
|
73
59
|
getAddress(): Promise<string>;
|
|
60
|
+
private _retryRequest;
|
|
74
61
|
/**
|
|
75
62
|
* The balance of the signer
|
|
76
63
|
* @returns The balance of the signer in winston units
|
|
@@ -2,94 +2,40 @@ import Arweave from "arweave";
|
|
|
2
2
|
import { create } from "superstruct";
|
|
3
3
|
import { ARWEAVE_TAG_APP_NAME, ARWEAVE_TAG_APP_VERSION, DEFAULT_ARWEAVE_STORAGE_ADDRESS } from "../../constants";
|
|
4
4
|
import { BigNumber, delay, fetchWithTimeout, isDefined, jsonReplacerWithBigNumbers, toBN } from "../../utils";
|
|
5
|
-
export const DEFAULT_ARWEAVE_GATEWAYS = [{ host: "arweave.net" }, { host: "ar-io.net" }];
|
|
6
5
|
export class ArweaveClient {
|
|
7
6
|
arweaveJWT;
|
|
8
7
|
logger;
|
|
8
|
+
gatewayURL;
|
|
9
|
+
protocol;
|
|
9
10
|
retries;
|
|
10
11
|
retryDelaySeconds;
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
client;
|
|
13
|
+
gatewayUrl;
|
|
14
|
+
constructor(arweaveJWT, logger, gatewayURL = "arweave.net", protocol = "https", port = 443, retries = 2, retryDelaySeconds = 1) {
|
|
13
15
|
this.arweaveJWT = arweaveJWT;
|
|
14
16
|
this.logger = logger;
|
|
17
|
+
this.gatewayURL = gatewayURL;
|
|
18
|
+
this.protocol = protocol;
|
|
15
19
|
this.retries = retries;
|
|
16
20
|
this.retryDelaySeconds = retryDelaySeconds;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
this.gateways = gateways.map(({ host, protocol = "https", port = 443 }) => ({
|
|
27
|
-
client: new Arweave({ host, port, protocol, timeout: 20000, logging: false }),
|
|
28
|
-
url: `${protocol}://${host}:${port}`,
|
|
29
|
-
}));
|
|
21
|
+
this.gatewayUrl = `${protocol}://${gatewayURL}:${port}`;
|
|
22
|
+
this.client = new Arweave({
|
|
23
|
+
host: gatewayURL,
|
|
24
|
+
port,
|
|
25
|
+
protocol,
|
|
26
|
+
timeout: 20000,
|
|
27
|
+
logging: false,
|
|
28
|
+
});
|
|
30
29
|
this.logger.debug({
|
|
31
30
|
at: "ArweaveClient:constructor",
|
|
32
31
|
message: "Arweave client initialized",
|
|
33
|
-
|
|
32
|
+
gateway: this.gatewayUrl,
|
|
34
33
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
* Races a request across all gateways, returning the first successful response.
|
|
38
|
-
* If all gateways fail, throws an error with details from each gateway.
|
|
39
|
-
*/
|
|
40
|
-
async _raceGateways(label, fn) {
|
|
41
|
-
try {
|
|
42
|
-
return await Promise.any(this.gateways.map((gw) => this._retryRequest(() => fn(gw), 0)));
|
|
43
|
-
}
|
|
44
|
-
catch (e) {
|
|
45
|
-
if (e instanceof AggregateError) {
|
|
46
|
-
const details = this.gateways.map((gw, i) => `${gw.url}: ${e.errors[i]}`).join("; ");
|
|
47
|
-
throw new Error(`All Arweave gateways failed for ${label}: ${details}`);
|
|
48
|
-
}
|
|
49
|
-
throw e;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Tries gateways sequentially, returning the first successful response.
|
|
54
|
-
* Used for write operations where we want exactly one successful submission.
|
|
55
|
-
*/
|
|
56
|
-
async _failoverGateways(label, fn) {
|
|
57
|
-
const errors = [];
|
|
58
|
-
for (const gw of this.gateways) {
|
|
59
|
-
try {
|
|
60
|
-
return await this._retryRequest(() => fn(gw), 0);
|
|
61
|
-
}
|
|
62
|
-
catch (e) {
|
|
63
|
-
errors.push(e);
|
|
64
|
-
this.logger.debug({
|
|
65
|
-
at: "ArweaveClient:failoverGateways",
|
|
66
|
-
message: `Gateway ${gw.url} failed for ${label}, trying next: ${e}`,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
const details = this.gateways.map((gw, i) => `${gw.url}: ${errors[i]}`).join("; ");
|
|
71
|
-
throw new Error(`All Arweave gateways failed for ${label}: ${details}`);
|
|
72
|
-
}
|
|
73
|
-
async _retryRequest(request, retryCount) {
|
|
74
|
-
try {
|
|
75
|
-
return await request();
|
|
34
|
+
if (this.retries < 0) {
|
|
35
|
+
throw new Error(`retries cannot be < 0 and must be an integer. Currently set to ${this.retries}`);
|
|
76
36
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
// Implement a slightly aggressive exponential backoff to account for fierce parallelism.
|
|
80
|
-
const baseDelay = this.retryDelaySeconds * Math.pow(2, retryCount);
|
|
81
|
-
const delayS = baseDelay + baseDelay * Math.random();
|
|
82
|
-
this.logger.debug({
|
|
83
|
-
at: "ArweaveClient:retryRequest",
|
|
84
|
-
message: `Arweave request failed, retrying after waiting ${delayS} seconds: ${e}`,
|
|
85
|
-
retryCount,
|
|
86
|
-
});
|
|
87
|
-
await delay(delayS);
|
|
88
|
-
return this._retryRequest(request, retryCount + 1);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
throw e;
|
|
92
|
-
}
|
|
37
|
+
if (this.retryDelaySeconds < 0) {
|
|
38
|
+
throw new Error(`delay cannot be < 0. Currently set to ${this.retryDelaySeconds}`);
|
|
93
39
|
}
|
|
94
40
|
}
|
|
95
41
|
/**
|
|
@@ -99,12 +45,10 @@ export class ArweaveClient {
|
|
|
99
45
|
* @param value The value to store
|
|
100
46
|
* @param topicTag An optional topic tag to add to the transaction
|
|
101
47
|
* @returns The transaction ID of the stored value
|
|
48
|
+
* @
|
|
102
49
|
*/
|
|
103
50
|
async set(value, topicTag) {
|
|
104
|
-
|
|
105
|
-
// it does not matter which gateway is used, so we just choose the first one.
|
|
106
|
-
const templateClient = this.gateways[0].client;
|
|
107
|
-
const transaction = await templateClient.createTransaction({ data: JSON.stringify(value, jsonReplacerWithBigNumbers) }, this.arweaveJWT);
|
|
51
|
+
const transaction = await this.client.createTransaction({ data: JSON.stringify(value, jsonReplacerWithBigNumbers) }, this.arweaveJWT);
|
|
108
52
|
// Add tags to the transaction
|
|
109
53
|
transaction.addTag("Content-Type", "application/json");
|
|
110
54
|
transaction.addTag("App-Name", ARWEAVE_TAG_APP_NAME);
|
|
@@ -113,29 +57,29 @@ export class ArweaveClient {
|
|
|
113
57
|
transaction.addTag("Topic", topicTag);
|
|
114
58
|
}
|
|
115
59
|
// Sign the transaction
|
|
116
|
-
await
|
|
60
|
+
await this.client.transactions.sign(transaction, this.arweaveJWT);
|
|
117
61
|
// Send the transaction
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
62
|
+
const result = await this.client.transactions.post(transaction);
|
|
63
|
+
// Ensure that the result is successful
|
|
64
|
+
if (result.status !== 200) {
|
|
65
|
+
const message = result?.data?.error?.msg ?? "Unknown error";
|
|
66
|
+
this.logger.error({
|
|
67
|
+
at: "ArweaveClient:set",
|
|
68
|
+
message,
|
|
69
|
+
result,
|
|
70
|
+
txn: transaction.id,
|
|
71
|
+
address: await this.getAddress(),
|
|
72
|
+
balance: (await this.getBalance()).toString(),
|
|
73
|
+
});
|
|
74
|
+
throw new Error(message);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
133
77
|
this.logger.debug({
|
|
134
78
|
at: "ArweaveClient:set",
|
|
135
79
|
message: `Arweave transaction posted with ${transaction.id}`,
|
|
136
80
|
});
|
|
137
|
-
|
|
138
|
-
|
|
81
|
+
}
|
|
82
|
+
return transaction.id;
|
|
139
83
|
}
|
|
140
84
|
/**
|
|
141
85
|
* Retrieves a record from the Arweave network. The record is expected to be a JSON string and is
|
|
@@ -145,12 +89,15 @@ export class ArweaveClient {
|
|
|
145
89
|
* @returns The record if it exists, otherwise null
|
|
146
90
|
*/
|
|
147
91
|
async get(transactionID, validator) {
|
|
148
|
-
//
|
|
92
|
+
// Resolve the URL of the transaction
|
|
93
|
+
const transactionUrl = `${this.gatewayUrl}/${transactionID}`;
|
|
94
|
+
// We should query in via Axios directly to the gateway URL. The reasoning behind this is
|
|
149
95
|
// that the Arweave SDK's `getData` method is too slow and does not provide a way to set a timeout.
|
|
150
96
|
// Therefore, something that could take milliseconds to complete could take tens of minutes.
|
|
151
|
-
const
|
|
152
|
-
return await fetchWithTimeout(
|
|
153
|
-
}
|
|
97
|
+
const request = async () => {
|
|
98
|
+
return await fetchWithTimeout(transactionUrl, {}, {}, 20_000);
|
|
99
|
+
};
|
|
100
|
+
const data = await this._retryRequest(request, 0);
|
|
154
101
|
try {
|
|
155
102
|
// We should validate the data and perform any logical coercion here.
|
|
156
103
|
return create(data, validator);
|
|
@@ -189,13 +136,13 @@ export class ArweaveClient {
|
|
|
189
136
|
]
|
|
190
137
|
) { edges { node { id } } }
|
|
191
138
|
}`;
|
|
192
|
-
const response = await this.
|
|
193
|
-
const response = await client.api.post("/graphql", { query });
|
|
139
|
+
const response = await this._retryRequest(async () => {
|
|
140
|
+
const response = await this.client.api.post("/graphql", { query });
|
|
194
141
|
if (!response.ok) {
|
|
195
142
|
throw new Error(`Arweave GraphQL request failed with status ${response.status}`);
|
|
196
143
|
}
|
|
197
144
|
return response;
|
|
198
|
-
});
|
|
145
|
+
}, 0);
|
|
199
146
|
const entries = response?.data?.data?.transactions?.edges ?? [];
|
|
200
147
|
this.logger.debug({
|
|
201
148
|
at: "ArweaveClient:getByTopic",
|
|
@@ -233,9 +180,7 @@ export class ArweaveClient {
|
|
|
233
180
|
* @returns The metadata of the transaction if it exists, otherwise null
|
|
234
181
|
*/
|
|
235
182
|
async getMetadata(transactionID) {
|
|
236
|
-
const transaction = await this.
|
|
237
|
-
return await client.transactions.get(transactionID);
|
|
238
|
-
});
|
|
183
|
+
const transaction = await this.client.transactions.get(transactionID);
|
|
239
184
|
if (!isDefined(transaction)) {
|
|
240
185
|
return null;
|
|
241
186
|
}
|
|
@@ -250,12 +195,33 @@ export class ArweaveClient {
|
|
|
250
195
|
};
|
|
251
196
|
}
|
|
252
197
|
/**
|
|
253
|
-
* Returns the address of the signer of the JWT
|
|
254
|
-
* operation and does not require a network call.
|
|
198
|
+
* Returns the address of the signer of the JWT
|
|
255
199
|
* @returns The address of the signer in this client
|
|
256
200
|
*/
|
|
257
201
|
getAddress() {
|
|
258
|
-
return this.
|
|
202
|
+
return this.client.wallets.jwkToAddress(this.arweaveJWT);
|
|
203
|
+
}
|
|
204
|
+
async _retryRequest(request, retryCount) {
|
|
205
|
+
try {
|
|
206
|
+
return await request();
|
|
207
|
+
}
|
|
208
|
+
catch (e) {
|
|
209
|
+
if (retryCount < this.retries) {
|
|
210
|
+
// Implement a slightly aggressive exponential backoff to account for fierce parallelism.
|
|
211
|
+
const baseDelay = this.retryDelaySeconds * Math.pow(2, retryCount); // ms; attempt = [0, 1, 2, ...]
|
|
212
|
+
const delayS = baseDelay + baseDelay * Math.random();
|
|
213
|
+
this.logger.debug({
|
|
214
|
+
at: "ArweaveClient:retryRequest",
|
|
215
|
+
message: `Arweave request failed, retrying after waiting ${delayS} seconds: ${e}`,
|
|
216
|
+
retryCount,
|
|
217
|
+
});
|
|
218
|
+
await delay(delayS);
|
|
219
|
+
return this._retryRequest(request, retryCount + 1);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
throw e;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
259
225
|
}
|
|
260
226
|
/**
|
|
261
227
|
* The balance of the signer
|
|
@@ -263,9 +229,9 @@ export class ArweaveClient {
|
|
|
263
229
|
*/
|
|
264
230
|
async getBalance() {
|
|
265
231
|
const address = await this.getAddress();
|
|
266
|
-
|
|
267
|
-
const balanceInFloat = await client.wallets.getBalance(address);
|
|
268
|
-
// @dev The reason we add in the BN.from
|
|
232
|
+
const request = async () => {
|
|
233
|
+
const balanceInFloat = await this.client.wallets.getBalance(address);
|
|
234
|
+
// @dev The reason we add in the BN.from into this retry loop is because the client.getBalance call
|
|
269
235
|
// does not correctly throw an error if the request fails, instead it will return the error string as the
|
|
270
236
|
// balanceInFloat.
|
|
271
237
|
// Sometimes the balance is returned in scientific notation, so we need to
|
|
@@ -278,7 +244,8 @@ export class ArweaveClient {
|
|
|
278
244
|
else {
|
|
279
245
|
return BigNumber.from(balanceInFloat);
|
|
280
246
|
}
|
|
281
|
-
}
|
|
247
|
+
};
|
|
248
|
+
return await this._retryRequest(request, 0);
|
|
282
249
|
}
|
|
283
250
|
}
|
|
284
251
|
//# sourceMappingURL=ArweaveClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArweaveClient.js","sourceRoot":"","sources":["../../../../../src/caching/Arweave/ArweaveClient.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,OAAO,EAAU,MAAM,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,+BAA+B,EAAE,MAAM,iBAAiB,CAAC;AACjH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,0BAA0B,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"ArweaveClient.js","sourceRoot":"","sources":["../../../../../src/caching/Arweave/ArweaveClient.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,OAAO,EAAU,MAAM,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,+BAA+B,EAAE,MAAM,iBAAiB,CAAC;AACjH,OA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