@gardenfi/utils 2.5.2 → 2.5.3-beta.0
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/README.md +9 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +37 -36
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +4 -4
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +16 -20
- package/dist/index112.cjs +1 -1
- package/dist/index112.js +15 -15
- package/dist/index121.cjs +1 -1
- package/dist/index121.js +1 -1
- package/dist/index130.cjs +1 -1
- package/dist/index130.js +1 -1
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +4 -4
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +20 -9
- package/dist/index197.cjs +1 -1
- package/dist/index197.js +17 -30
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +84 -51
- package/dist/index226.cjs +1 -1
- package/dist/index226.js +2 -2
- package/dist/index229.cjs +1 -1
- package/dist/index229.js +2 -2
- package/dist/index230.cjs +1 -1
- package/dist/index230.js +1 -1
- package/dist/index234.cjs +1 -1
- package/dist/index234.js +7 -8
- package/dist/index235.cjs +1 -1
- package/dist/index235.js +1 -1
- package/dist/index236.cjs +1 -1
- package/dist/index236.js +1 -1
- package/dist/index237.cjs +1 -1
- package/dist/index237.js +2 -2
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +30 -13
- package/dist/index249.cjs +1 -1
- package/dist/index249.js +3 -3
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +30 -58
- package/dist/index250.cjs +1 -1
- package/dist/index250.js +3 -3
- package/dist/index256.cjs +1 -1
- package/dist/index256.js +17 -12
- package/dist/index26.cjs +1 -16
- package/dist/index26.js +11 -113
- package/dist/index269.cjs +1 -1
- package/dist/index269.js +4 -4
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +58 -32
- package/dist/index270.cjs +1 -1
- package/dist/index270.js +5 -5
- package/dist/index271.cjs +1 -1
- package/dist/index271.js +27 -21
- package/dist/index272.cjs +1 -1
- package/dist/index272.js +54 -20
- package/dist/index273.cjs +1 -1
- package/dist/index273.js +18 -54
- package/dist/index274.cjs +1 -1
- package/dist/index274.js +10 -34
- package/dist/index275.cjs +1 -1
- package/dist/index275.js +7 -10
- package/dist/index276.cjs +1 -1
- package/dist/index276.js +12 -13
- package/dist/index277.cjs +1 -1
- package/dist/index277.js +11 -12
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +13 -31
- package/dist/index280.cjs +1 -1
- package/dist/index280.js +103 -11
- package/dist/index281.cjs +1 -1
- package/dist/index281.js +6 -103
- package/dist/index282.cjs +1 -1
- package/dist/index282.js +243 -5
- package/dist/index283.cjs +1 -1
- package/dist/index283.js +6 -224
- package/dist/index284.cjs +1 -1
- package/dist/index284.js +7 -7
- package/dist/index285.cjs +1 -1
- package/dist/index285.js +27 -7
- package/dist/index286.cjs +1 -1
- package/dist/index286.js +18 -25
- package/dist/index287.cjs +1 -1
- package/dist/index287.js +145 -18
- package/dist/index288.cjs +1 -1
- package/dist/index288.js +3 -146
- package/dist/index289.cjs +1 -1
- package/dist/index289.js +155 -3
- package/dist/index29.cjs +16 -1
- package/dist/index29.js +113 -11
- package/dist/index290.cjs +1 -1
- package/dist/index290.js +7 -138
- package/dist/index291.cjs +1 -1
- package/dist/index291.js +128 -143
- package/dist/index292.cjs +1 -1
- package/dist/index292.js +111 -7
- package/dist/index293.cjs +2 -1
- package/dist/index293.js +116 -95
- package/dist/index294.cjs +1 -2
- package/dist/index294.js +35 -127
- package/dist/index295.cjs +1 -1
- package/dist/index295.js +66 -30
- package/dist/index296.cjs +1 -1
- package/dist/index296.js +2 -79
- package/dist/index297.cjs +1 -1
- package/dist/index297.js +12 -2
- package/dist/index298.cjs +1 -1
- package/dist/index298.js +19 -11
- package/dist/index299.cjs +1 -1
- package/dist/index299.js +68 -19
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +10 -8
- package/dist/index300.cjs +1 -1
- package/dist/index300.js +786 -66
- package/dist/index301.cjs +1 -1
- package/dist/index301.js +134 -684
- package/dist/index302.cjs +1 -1
- package/dist/index302.js +185 -124
- package/dist/index303.cjs +2 -1
- package/dist/index303.js +63 -198
- package/dist/index304.cjs +1 -2
- package/dist/index304.js +7 -66
- package/dist/index305.cjs +1 -1
- package/dist/index305.js +62 -4
- package/dist/index306.cjs +1 -1
- package/dist/index306.js +22 -40
- package/dist/index307.cjs +1 -1
- package/dist/index307.js +5 -7
- package/dist/index308.cjs +1 -1
- package/dist/index308.js +72 -57
- package/dist/index309.cjs +1 -1
- package/dist/index309.js +4 -78
- package/dist/index310.cjs +1 -1
- package/dist/index310.js +195 -4
- package/dist/index311.cjs +1 -1
- package/dist/index311.js +4 -194
- package/dist/index312.cjs +1 -1
- package/dist/index312.js +35 -58
- package/dist/index313.cjs +2 -1
- package/dist/index313.js +40 -43
- package/dist/index314.cjs +1 -1
- package/dist/index314.js +2 -5
- package/dist/index315.cjs +1 -1
- package/dist/index315.js +11 -5
- package/dist/index316.cjs +1 -1
- package/dist/index316.js +20 -2
- package/dist/index317.cjs +1 -1
- package/dist/index317.js +8 -21
- package/dist/index318.cjs +1 -0
- package/dist/index318.js +45 -0
- package/dist/index319.cjs +1 -0
- package/dist/index319.js +69 -0
- package/dist/index320.cjs +1 -0
- package/dist/index320.js +68 -0
- package/dist/index321.cjs +1 -0
- package/dist/index321.js +191 -0
- package/dist/index322.cjs +1 -0
- package/dist/index322.js +79 -0
- package/dist/index323.cjs +1 -0
- package/dist/index323.js +43 -0
- package/dist/index324.cjs +1 -0
- package/dist/index324.js +19 -0
- package/dist/index325.cjs +1 -0
- package/dist/index325.js +16 -0
- package/dist/index326.cjs +1 -0
- package/dist/index326.js +7 -0
- package/dist/index327.cjs +1 -0
- package/dist/index327.js +66 -0
- package/dist/index328.cjs +1 -0
- package/dist/index328.js +7 -0
- package/dist/index329.cjs +1 -0
- package/dist/index329.js +47 -0
- package/dist/index330.cjs +1 -0
- package/dist/index330.js +71 -0
- package/dist/index331.cjs +1 -0
- package/dist/index331.js +4 -0
- package/dist/index332.cjs +1 -0
- package/dist/index332.js +24 -0
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +1 -1
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +35 -34
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +26 -30
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +13 -9
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +19 -19
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +31 -30
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +2 -2
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +73 -73
- package/dist/src/lib/auth/apikey/apikey.d.ts +1 -1
- package/dist/src/lib/auth/auth.types.d.ts +1 -1
- package/dist/src/lib/fetcher/fetcher.d.ts +2 -0
- package/dist/src/lib/utils.d.ts +1 -0
- package/package.json +2 -2
package/dist/index89.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { multicall3Abi as
|
|
2
|
-
import { AbiDecodingZeroDataError as
|
|
3
|
-
import { BaseError as
|
|
4
|
-
import { RawContractError as
|
|
5
|
-
import { decodeFunctionResult as
|
|
1
|
+
import { multicall3Abi as _ } from "./index22.js";
|
|
2
|
+
import { AbiDecodingZeroDataError as v } from "./index127.js";
|
|
3
|
+
import { BaseError as q } from "./index41.js";
|
|
4
|
+
import { RawContractError as B } from "./index132.js";
|
|
5
|
+
import { decodeFunctionResult as L } from "./index175.js";
|
|
6
6
|
import { encodeFunctionData as O } from "./index182.js";
|
|
7
7
|
import { getChainContractAddress as T } from "./index219.js";
|
|
8
8
|
import { getContractError as F } from "./index225.js";
|
|
9
9
|
import { getAction as Z } from "./index32.js";
|
|
10
10
|
import { readContract as G } from "./index36.js";
|
|
11
|
-
async function
|
|
11
|
+
async function Y(n, w) {
|
|
12
12
|
var D;
|
|
13
|
-
const { account: b, allowFailure: u = !0, batchSize:
|
|
14
|
-
let m =
|
|
13
|
+
const { account: b, authorizationList: j, allowFailure: u = !0, batchSize: y, blockNumber: p, blockTag: N, multicallAddress: R, stateOverride: x } = w, h = w.contracts, C = y ?? (typeof ((D = n.batch) == null ? void 0 : D.multicall) == "object" && n.batch.multicall.batchSize || 1024);
|
|
14
|
+
let m = R;
|
|
15
15
|
if (!m) {
|
|
16
16
|
if (!n.chain)
|
|
17
17
|
throw new Error("client chain not configured. multicallAddress is required.");
|
|
@@ -23,8 +23,8 @@ async function X(n, w) {
|
|
|
23
23
|
}
|
|
24
24
|
const e = [[]];
|
|
25
25
|
let a = 0, f = 0;
|
|
26
|
-
for (let t = 0; t <
|
|
27
|
-
const { abi: o, address: s, args: r, functionName: i } =
|
|
26
|
+
for (let t = 0; t < h.length; t++) {
|
|
27
|
+
const { abi: o, address: s, args: r, functionName: i } = h[t];
|
|
28
28
|
try {
|
|
29
29
|
const c = O({ abi: o, args: r, functionName: i });
|
|
30
30
|
f += (c.length - 2) / 2, // Check if batching is enabled.
|
|
@@ -60,14 +60,15 @@ async function X(n, w) {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
const A = await Promise.allSettled(e.map((t) => Z(n, G, "readContract")({
|
|
63
|
-
abi:
|
|
63
|
+
abi: _,
|
|
64
64
|
account: b,
|
|
65
65
|
address: m,
|
|
66
66
|
args: [t],
|
|
67
|
+
authorizationList: j,
|
|
67
68
|
blockNumber: p,
|
|
68
|
-
blockTag:
|
|
69
|
+
blockTag: N,
|
|
69
70
|
functionName: "aggregate3",
|
|
70
|
-
stateOverride:
|
|
71
|
+
stateOverride: x
|
|
71
72
|
}))), l = [];
|
|
72
73
|
for (let t = 0; t < A.length; t++) {
|
|
73
74
|
const o = A[t];
|
|
@@ -84,26 +85,26 @@ async function X(n, w) {
|
|
|
84
85
|
}
|
|
85
86
|
const s = o.value;
|
|
86
87
|
for (let r = 0; r < s.length; r++) {
|
|
87
|
-
const { returnData: i, success: c } = s[r], { callData: g } = e[t][r], { abi:
|
|
88
|
+
const { returnData: i, success: c } = s[r], { callData: g } = e[t][r], { abi: z, address: P, functionName: S, args: k } = h[l.length];
|
|
88
89
|
try {
|
|
89
90
|
if (g === "0x")
|
|
90
|
-
throw new
|
|
91
|
+
throw new v();
|
|
91
92
|
if (!c)
|
|
92
|
-
throw new
|
|
93
|
-
const
|
|
94
|
-
abi:
|
|
95
|
-
args:
|
|
93
|
+
throw new B({ data: i });
|
|
94
|
+
const d = L({
|
|
95
|
+
abi: z,
|
|
96
|
+
args: k,
|
|
96
97
|
data: i,
|
|
97
|
-
functionName:
|
|
98
|
+
functionName: S
|
|
98
99
|
});
|
|
99
|
-
l.push(u ? { result:
|
|
100
|
-
} catch (
|
|
101
|
-
const E = F(
|
|
102
|
-
abi:
|
|
103
|
-
address:
|
|
104
|
-
args:
|
|
100
|
+
l.push(u ? { result: d, status: "success" } : d);
|
|
101
|
+
} catch (d) {
|
|
102
|
+
const E = F(d, {
|
|
103
|
+
abi: z,
|
|
104
|
+
address: P,
|
|
105
|
+
args: k,
|
|
105
106
|
docsPath: "/docs/contract/multicall",
|
|
106
|
-
functionName:
|
|
107
|
+
functionName: S
|
|
107
108
|
});
|
|
108
109
|
if (!u)
|
|
109
110
|
throw E;
|
|
@@ -111,10 +112,10 @@ async function X(n, w) {
|
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
|
-
if (l.length !==
|
|
115
|
-
throw new
|
|
115
|
+
if (l.length !== h.length)
|
|
116
|
+
throw new q("multicall results mismatch");
|
|
116
117
|
return l;
|
|
117
118
|
}
|
|
118
119
|
export {
|
|
119
|
-
|
|
120
|
+
Y as multicall
|
|
120
121
|
};
|
package/dist/index9.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=(t=>(t.Authorization="Authorization",t.ApiKey="
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=(t=>(t.Authorization="Authorization",t.ApiKey="garden-app-id",t))(e||{});exports.AuthHeaderEnum=e;
|
package/dist/index9.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var r = /* @__PURE__ */ ((i) => (i.Authorization = "Authorization", i.ApiKey = "garden-app-id", i))(r || {});
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
r as AuthHeaderEnum
|
|
4
4
|
};
|
package/dist/index95.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./index131.cjs"),k=require("./index140.cjs"),f=require("./index32.cjs"),$=require("./index43.cjs"),C=require("./index45.cjs"),B=require("./index46.cjs"),D=require("./index47.cjs"),P=require("./index73.cjs"),W=require("./index86.cjs"),y=require("./index21.cjs"),z=require("./index96.cjs");async function G(r,b){const{checkReplacement:A=!0,confirmations:c=1,hash:p,onReplaced:F,retryCount:h=6,retryDelay:N=({count:t})=>~~(1<<t)*200,timeout:w=18e4}=b,I=D.stringify(["waitForTransactionReceipt",r.uid,p]),j=(()=>{var t;return b.pollingInterval?b.pollingInterval:(t=r.chain)!=null&&t.experimental_preconfirmationTime?r.chain.experimental_preconfirmationTime:r.pollingInterval})();let s,i,e,l=!1,n,a;const{promise:E,resolve:x,reject:v}=C.withResolvers(),q=w?setTimeout(()=>{a==null||a(),n==null||n(),v(new k.WaitForTransactionReceiptTimeoutError({hash:p}))},w):void 0;return n=$.observe(I,{onReplaced:F,resolve:x,reject:v},async t=>{if(e=await f.getAction(r,y.getTransactionReceipt,"getTransactionReceipt")({hash:p}).catch(()=>{}),e&&c<=1){clearTimeout(q),t.resolve(e),n==null||n();return}a=f.getAction(r,z.watchBlockNumber,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:j,async onBlockNumber(M){const g=d=>{clearTimeout(q),a==null||a(),d(),n==null||n()};let T=M;if(!l)try{if(e){if(c>1&&(!e.blockNumber||T-e.blockNumber+1n<c))return;g(()=>t.resolve(e));return}if(A&&!s&&(l=!0,await B.withRetry(async()=>{s=await f.getAction(r,W.getTransaction,"getTransaction")({hash:p}),s.blockNumber&&(T=s.blockNumber)},{delay:N,retryCount:h}),l=!1),e=await f.getAction(r,y.getTransactionReceipt,"getTransactionReceipt")({hash:p}),c>1&&(!e.blockNumber||T-e.blockNumber+1n<c))return;g(()=>t.resolve(e))}catch(d){if(d instanceof k.TransactionNotFoundError||d instanceof k.TransactionReceiptNotFoundError){if(!s){l=!1;return}try{i=s,l=!0;const m=await B.withRetry(()=>f.getAction(r,P.getBlock,"getBlock")({blockNumber:T,includeTransactions:!0}),{delay:N,retryCount:h,shouldRetry:({error:u})=>u instanceof S.BlockNotFoundError});l=!1;const o=m.transactions.find(({from:u,nonce:O})=>u===i.from&&O===i.nonce);if(!o||(e=await f.getAction(r,y.getTransactionReceipt,"getTransactionReceipt")({hash:o.hash}),c>1&&(!e.blockNumber||T-e.blockNumber+1n<c)))return;let R="replaced";o.to===i.to&&o.value===i.value&&o.input===i.input?R="repriced":o.from===o.to&&o.value===0n&&(R="cancelled"),g(()=>{var u;(u=t.onReplaced)==null||u.call(t,{reason:R,replacedTransaction:i,transaction:o,transactionReceipt:e}),t.resolve(e)})}catch(m){g(()=>t.reject(m))}}else g(()=>t.reject(d))}}})}),E}exports.waitForTransactionReceipt=G;
|
package/dist/index95.js
CHANGED
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
import { BlockNotFoundError as
|
|
2
|
-
import { WaitForTransactionReceiptTimeoutError as
|
|
3
|
-
import { getAction as
|
|
4
|
-
import { observe as
|
|
5
|
-
import { withResolvers as
|
|
1
|
+
import { BlockNotFoundError as M } from "./index131.js";
|
|
2
|
+
import { WaitForTransactionReceiptTimeoutError as O, TransactionNotFoundError as W, TransactionReceiptNotFoundError as q } from "./index140.js";
|
|
3
|
+
import { getAction as u } from "./index32.js";
|
|
4
|
+
import { observe as z } from "./index43.js";
|
|
5
|
+
import { withResolvers as G } from "./index45.js";
|
|
6
6
|
import { withRetry as B } from "./index46.js";
|
|
7
|
-
import { stringify as
|
|
8
|
-
import { getBlock as
|
|
9
|
-
import { getTransaction as
|
|
10
|
-
import { getTransactionReceipt as
|
|
11
|
-
import { watchBlockNumber as
|
|
12
|
-
async function
|
|
7
|
+
import { stringify as H } from "./index47.js";
|
|
8
|
+
import { getBlock as J } from "./index73.js";
|
|
9
|
+
import { getTransaction as K } from "./index86.js";
|
|
10
|
+
import { getTransactionReceipt as y } from "./index21.js";
|
|
11
|
+
import { watchBlockNumber as L } from "./index96.js";
|
|
12
|
+
async function er(t, b) {
|
|
13
13
|
const {
|
|
14
14
|
checkReplacement: F = !0,
|
|
15
|
-
confirmations:
|
|
16
|
-
hash:
|
|
17
|
-
onReplaced:
|
|
18
|
-
retryCount:
|
|
19
|
-
retryDelay:
|
|
15
|
+
confirmations: a = 1,
|
|
16
|
+
hash: m,
|
|
17
|
+
onReplaced: I,
|
|
18
|
+
retryCount: N = 6,
|
|
19
|
+
retryDelay: R = ({ count: e }) => ~~(1 << e) * 200,
|
|
20
20
|
// exponential backoff
|
|
21
|
-
timeout:
|
|
22
|
-
} =
|
|
23
|
-
var
|
|
24
|
-
return
|
|
21
|
+
timeout: h = 18e4
|
|
22
|
+
} = b, E = H(["waitForTransactionReceipt", t.uid, m]), j = (() => {
|
|
23
|
+
var e;
|
|
24
|
+
return b.pollingInterval ? b.pollingInterval : (e = t.chain) != null && e.experimental_preconfirmationTime ? t.chain.experimental_preconfirmationTime : t.pollingInterval;
|
|
25
25
|
})();
|
|
26
|
-
let
|
|
27
|
-
const { promise:
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
return
|
|
31
|
-
if (
|
|
32
|
-
}),
|
|
33
|
-
clearTimeout(w),
|
|
26
|
+
let l, i, r, s = !1, o, c;
|
|
27
|
+
const { promise: x, resolve: A, reject: v } = G(), w = h ? setTimeout(() => {
|
|
28
|
+
c == null || c(), o == null || o(), v(new O({ hash: m }));
|
|
29
|
+
}, h) : void 0;
|
|
30
|
+
return o = z(E, { onReplaced: I, resolve: A, reject: v }, async (e) => {
|
|
31
|
+
if (r = await u(t, y, "getTransactionReceipt")({ hash: m }).catch(() => {
|
|
32
|
+
}), r && a <= 1) {
|
|
33
|
+
clearTimeout(w), e.resolve(r), o == null || o();
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
c = u(t, L, "watchBlockNumber")({
|
|
37
37
|
emitMissed: !0,
|
|
38
38
|
emitOnBegin: !0,
|
|
39
39
|
poll: !0,
|
|
40
|
-
pollingInterval:
|
|
41
|
-
async onBlockNumber(
|
|
42
|
-
const
|
|
43
|
-
clearTimeout(w),
|
|
40
|
+
pollingInterval: j,
|
|
41
|
+
async onBlockNumber(C) {
|
|
42
|
+
const p = (T) => {
|
|
43
|
+
clearTimeout(w), c == null || c(), T(), o == null || o();
|
|
44
44
|
};
|
|
45
|
-
let
|
|
46
|
-
if (!
|
|
45
|
+
let d = C;
|
|
46
|
+
if (!s)
|
|
47
47
|
try {
|
|
48
|
-
if (
|
|
49
|
-
if (
|
|
48
|
+
if (r) {
|
|
49
|
+
if (a > 1 && (!r.blockNumber || d - r.blockNumber + 1n < a))
|
|
50
50
|
return;
|
|
51
|
-
|
|
51
|
+
p(() => e.resolve(r));
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
if (F && !
|
|
55
|
-
|
|
54
|
+
if (F && !l && (s = !0, await B(async () => {
|
|
55
|
+
l = await u(t, K, "getTransaction")({ hash: m }), l.blockNumber && (d = l.blockNumber);
|
|
56
56
|
}, {
|
|
57
|
-
delay:
|
|
58
|
-
retryCount:
|
|
59
|
-
}),
|
|
57
|
+
delay: R,
|
|
58
|
+
retryCount: N
|
|
59
|
+
}), s = !1), r = await u(t, y, "getTransactionReceipt")({ hash: m }), a > 1 && (!r.blockNumber || d - r.blockNumber + 1n < a))
|
|
60
60
|
return;
|
|
61
|
-
|
|
62
|
-
} catch (
|
|
63
|
-
if (
|
|
64
|
-
if (!
|
|
65
|
-
|
|
61
|
+
p(() => e.resolve(r));
|
|
62
|
+
} catch (T) {
|
|
63
|
+
if (T instanceof W || T instanceof q) {
|
|
64
|
+
if (!l) {
|
|
65
|
+
s = !1;
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
try {
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
blockNumber:
|
|
69
|
+
i = l, s = !0;
|
|
70
|
+
const k = await B(() => u(t, J, "getBlock")({
|
|
71
|
+
blockNumber: d,
|
|
72
72
|
includeTransactions: !0
|
|
73
73
|
}), {
|
|
74
|
-
delay:
|
|
75
|
-
retryCount:
|
|
76
|
-
shouldRetry: ({ error:
|
|
74
|
+
delay: R,
|
|
75
|
+
retryCount: N,
|
|
76
|
+
shouldRetry: ({ error: f }) => f instanceof M
|
|
77
77
|
});
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
if (!
|
|
81
|
-
hash:
|
|
82
|
-
}),
|
|
78
|
+
s = !1;
|
|
79
|
+
const n = k.transactions.find(({ from: f, nonce: D }) => f === i.from && D === i.nonce);
|
|
80
|
+
if (!n || (r = await u(t, y, "getTransactionReceipt")({
|
|
81
|
+
hash: n.hash
|
|
82
|
+
}), a > 1 && (!r.blockNumber || d - r.blockNumber + 1n < a)))
|
|
83
83
|
return;
|
|
84
|
-
let
|
|
85
|
-
|
|
86
|
-
var
|
|
87
|
-
(
|
|
88
|
-
reason:
|
|
89
|
-
replacedTransaction:
|
|
90
|
-
transaction:
|
|
91
|
-
transactionReceipt:
|
|
92
|
-
}),
|
|
84
|
+
let g = "replaced";
|
|
85
|
+
n.to === i.to && n.value === i.value && n.input === i.input ? g = "repriced" : n.from === n.to && n.value === 0n && (g = "cancelled"), p(() => {
|
|
86
|
+
var f;
|
|
87
|
+
(f = e.onReplaced) == null || f.call(e, {
|
|
88
|
+
reason: g,
|
|
89
|
+
replacedTransaction: i,
|
|
90
|
+
transaction: n,
|
|
91
|
+
transactionReceipt: r
|
|
92
|
+
}), e.resolve(r);
|
|
93
93
|
});
|
|
94
|
-
} catch (
|
|
95
|
-
|
|
94
|
+
} catch (k) {
|
|
95
|
+
p(() => e.reject(k));
|
|
96
96
|
}
|
|
97
97
|
} else
|
|
98
|
-
|
|
98
|
+
p(() => e.reject(T));
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
|
-
}),
|
|
102
|
+
}), x;
|
|
103
103
|
}
|
|
104
104
|
export {
|
|
105
|
-
|
|
105
|
+
er as waitForTransactionReceipt
|
|
106
106
|
};
|
|
@@ -2,7 +2,7 @@ import { AsyncResult, Result } from '../../result/result';
|
|
|
2
2
|
import { AuthHeader, IAuth } from '../auth.types';
|
|
3
3
|
|
|
4
4
|
export declare class ApiKey implements IAuth {
|
|
5
|
-
private readonly
|
|
5
|
+
private readonly _apiKey;
|
|
6
6
|
constructor(apiKey: string);
|
|
7
7
|
getToken(): AsyncResult<string, string>;
|
|
8
8
|
verifyToken(): Result<boolean, string>;
|
|
@@ -8,7 +8,7 @@ export type SiweOpts = {
|
|
|
8
8
|
};
|
|
9
9
|
export declare enum AuthHeaderEnum {
|
|
10
10
|
Authorization = "Authorization",
|
|
11
|
-
ApiKey = "
|
|
11
|
+
ApiKey = "garden-app-id"
|
|
12
12
|
}
|
|
13
13
|
export type AuthHeader = Record<AuthHeaderEnum.ApiKey, string> | Record<AuthHeaderEnum.Authorization, string>;
|
|
14
14
|
export interface IAuth {
|
|
@@ -31,6 +31,8 @@ export declare class Fetcher {
|
|
|
31
31
|
* Asynchronously sends a POST request to the specified URL or RequestInfo, with optional initialization options.
|
|
32
32
|
*/
|
|
33
33
|
static post<T>(input: RequestInfo | URL, init?: Request): Promise<T>;
|
|
34
|
+
private static _patch;
|
|
35
|
+
static patch<T>(input: RequestInfo | URL, init?: Request): Promise<T>;
|
|
34
36
|
/**
|
|
35
37
|
* Parses the response and returns the result as the specified type.
|
|
36
38
|
*
|
package/dist/src/lib/utils.d.ts
CHANGED
|
@@ -20,3 +20,4 @@ export declare enum Environment {
|
|
|
20
20
|
export declare const add0x: (str: string) => `0x${string}`;
|
|
21
21
|
export declare function hexToU32Array(hexString: string, endian?: 'big' | 'little'): number[];
|
|
22
22
|
export declare function trim0x(str: string): string;
|
|
23
|
+
export declare const hasKeys: (obj: any, keys: string[]) => any;
|
package/package.json
CHANGED