@gardenfi/utils 0.0.1-beta.13 → 0.0.1-beta.14
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/index10.cjs +1 -1
- package/dist/index10.js +10 -10
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +3 -3
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +1 -1
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +31 -18
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +17 -7
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +6 -19
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +20 -22
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +22 -8
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +8 -31
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +31 -26
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +25 -22
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +22 -51
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +51 -12
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +12 -24
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +24 -75
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +74 -22
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +23 -7
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +7 -29
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +28 -14
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +16 -2
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +2 -21
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +20 -11
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +11 -20
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +33 -18
- package/dist/index34.cjs +2 -2
- package/dist/index34.js +8 -8
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +2 -9
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +4 -12
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +11 -34
- package/dist/index38.cjs +1 -1
- package/dist/index38.js +4 -2
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +21 -4
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +13 -12
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +12 -11
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +55 -3
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +6 -12
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +20 -54
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +11 -6
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +3 -21
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +6 -11
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +11 -3
- package/dist/index48.cjs +1 -1
- package/dist/index48.js +19 -6
- package/dist/index49.cjs +1 -1
- package/dist/index49.js +8 -104
- package/dist/index50.cjs +1 -1
- package/dist/index50.js +102 -27
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +28 -17
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +16 -30
- package/dist/index53.cjs +1 -0
- package/dist/index53.js +35 -0
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +27 -21
- package/dist/src/lib/approve.d.ts +0 -3
- package/package.json +1 -1
package/dist/index10.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./index15.cjs"),k=require("./index21.cjs"),g=require("./index27.cjs"),I=require("./index28.cjs"),v=require("./index31.cjs"),M=require("./index30.cjs"),O=require("./index14.cjs"),P=require("./index20.cjs"),q=require("./index23.cjs"),S=require("./index25.cjs");async function $(n,{confirmations:o=1,hash:f,onReplaced:B,pollingInterval:h=n.pollingInterval,retryCount:w=6,retryDelay:N=({count:p})=>~~(1<<p)*200,timeout:R=18e4}){const p=M.stringify(["waitForTransactionReceipt",n.uid,f]);let c,a,e,i=!1;return new Promise((m,y)=>{R&&setTimeout(()=>y(new k.WaitForTransactionReceiptTimeoutError({hash:f})),R);const F=I.observe(p,{onReplaced:B,resolve:m,reject:y},t=>{const A=g.getAction(n,S.watchBlockNumber,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:h,async onBlockNumber(E){const u=b=>{A(),b(),F()};let l=E;if(!i)try{if(e){if(o>1&&(!e.blockNumber||l-e.blockNumber+1n<o))return;u(()=>t.resolve(e));return}if(c||(i=!0,await v.withRetry(async()=>{c=await g.getAction(n,P.getTransaction,"getTransaction")({hash:f}),c.blockNumber&&(l=c.blockNumber)},{delay:N,retryCount:w}),i=!1),e=await g.getAction(n,q.getTransactionReceipt,"getTransactionReceipt")({hash:f}),o>1&&(!e.blockNumber||l-e.blockNumber+1n<o))return;u(()=>t.resolve(e))}catch(b){if(b instanceof k.TransactionNotFoundError||b instanceof k.TransactionReceiptNotFoundError){if(!c){i=!1;return}try{a=c,i=!0;const T=await v.withRetry(()=>g.getAction(n,O.getBlock,"getBlock")({blockNumber:l,includeTransactions:!0}),{delay:N,retryCount:w,shouldRetry:({error:s})=>s instanceof j.BlockNotFoundError});i=!1;const r=T.transactions.find(({from:s,nonce:_})=>s===a.from&&_===a.nonce);if(!r||(e=await g.getAction(n,q.getTransactionReceipt,"getTransactionReceipt")({hash:r.hash}),o>1&&(!e.blockNumber||l-e.blockNumber+1n<o)))return;let d="replaced";r.to===a.to&&r.value===a.value?d="repriced":r.from===r.to&&r.value===0n&&(d="cancelled"),u(()=>{var s;(s=t.onReplaced)==null||s.call(t,{reason:d,replacedTransaction:a,transaction:r,transactionReceipt:e}),t.resolve(e)})}catch(T){u(()=>t.reject(T))}}else u(()=>t.reject(b))}}})})})}exports.waitForTransactionReceipt=$;
|
package/dist/index10.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { BlockNotFoundError as j } from "./
|
|
2
|
-
import { WaitForTransactionReceiptTimeoutError as x, TransactionNotFoundError as A, TransactionReceiptNotFoundError as M } from "./
|
|
3
|
-
import { getAction as p } from "./
|
|
4
|
-
import { observe as O } from "./
|
|
5
|
-
import { withRetry as R } from "./
|
|
6
|
-
import { stringify as P } from "./
|
|
7
|
-
import { getBlock as W } from "./
|
|
8
|
-
import { getTransaction as q } from "./
|
|
9
|
-
import { getTransactionReceipt as v } from "./
|
|
10
|
-
import { watchBlockNumber as z } from "./
|
|
1
|
+
import { BlockNotFoundError as j } from "./index15.js";
|
|
2
|
+
import { WaitForTransactionReceiptTimeoutError as x, TransactionNotFoundError as A, TransactionReceiptNotFoundError as M } from "./index21.js";
|
|
3
|
+
import { getAction as p } from "./index27.js";
|
|
4
|
+
import { observe as O } from "./index28.js";
|
|
5
|
+
import { withRetry as R } from "./index31.js";
|
|
6
|
+
import { stringify as P } from "./index30.js";
|
|
7
|
+
import { getBlock as W } from "./index14.js";
|
|
8
|
+
import { getTransaction as q } from "./index20.js";
|
|
9
|
+
import { getTransactionReceipt as v } from "./index23.js";
|
|
10
|
+
import { watchBlockNumber as z } from "./index25.js";
|
|
11
11
|
async function Y(o, {
|
|
12
12
|
confirmations: n = 1,
|
|
13
13
|
hash: b,
|
package/dist/index11.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index47.cjs"),M=require("./index39.cjs"),h=require("./index48.cjs");function R(r){const{chainId:o,domain:s,expirationTime:l,issuedAt:m=new Date,nonce:a,notBefore:f,requestId:w,resources:g,scheme:i,uri:c,version:d}=r;{if(o!==Math.floor(o))throw new e.SiweInvalidMessageFieldError({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${o}`]});if(!(E.test(s)||F.test(s)||b.test(s)))throw new e.SiweInvalidMessageFieldError({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${s}`]});if(!A.test(a))throw new e.SiweInvalidMessageFieldError({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${a}`]});if(!h.isUri(c))throw new e.SiweInvalidMessageFieldError({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${c}`]});if(d!=="1")throw new e.SiweInvalidMessageFieldError({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${d}`]});if(i&&!P.test(i))throw new e.SiweInvalidMessageFieldError({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${i}`]});const t=r.statement;if(t!=null&&t.includes(`
|
|
2
2
|
`))throw new e.SiweInvalidMessageFieldError({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${t}`]})}const $=M.getAddress(r.address),v=i?`${i}://${s}`:s,I=r.statement?`${r.statement}
|
|
3
3
|
`:"",S=`${v} wants you to sign in with your Ethereum account:
|
|
4
4
|
${$}
|
package/dist/index11.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SiweInvalidMessageFieldError as e } from "./
|
|
2
|
-
import { getAddress as S } from "./
|
|
3
|
-
import { isUri as $ } from "./
|
|
1
|
+
import { SiweInvalidMessageFieldError as e } from "./index47.js";
|
|
2
|
+
import { getAddress as S } from "./index39.js";
|
|
3
|
+
import { isUri as $ } from "./index48.js";
|
|
4
4
|
function C(n) {
|
|
5
5
|
const { chainId: i, domain: s, expirationTime: u, issuedAt: g = /* @__PURE__ */ new Date(), nonce: a, notBefore: m, requestId: h, resources: w, scheme: o, uri: c, version: f } = n;
|
|
6
6
|
{
|
package/dist/index12.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index49.cjs"),a=e.defineChain({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}});exports.mainnet=a;
|
package/dist/index12.js
CHANGED
package/dist/index13.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 e=require("./index49.cjs"),a=e.defineChain({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc2.sepolia.org"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",blockCreated:5317080}},testnet:!0});exports.sepolia=a;
|
package/dist/index13.js
CHANGED
|
@@ -1,20 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
1
|
+
import { defineChain as e } from "./index49.js";
|
|
2
|
+
const s = /* @__PURE__ */ e({
|
|
3
|
+
id: 11155111,
|
|
4
|
+
name: "Sepolia",
|
|
5
|
+
nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
|
|
6
|
+
rpcUrls: {
|
|
7
|
+
default: {
|
|
8
|
+
http: ["https://rpc2.sepolia.org"]
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
blockExplorers: {
|
|
12
|
+
default: {
|
|
13
|
+
name: "Etherscan",
|
|
14
|
+
url: "https://sepolia.etherscan.io",
|
|
15
|
+
apiUrl: "https://api-sepolia.etherscan.io/api"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
contracts: {
|
|
19
|
+
multicall3: {
|
|
20
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
21
|
+
blockCreated: 751532
|
|
22
|
+
},
|
|
23
|
+
ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
|
|
24
|
+
ensUniversalResolver: {
|
|
25
|
+
address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",
|
|
26
|
+
blockCreated: 5317080
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
testnet: !0
|
|
30
|
+
});
|
|
18
31
|
export {
|
|
19
|
-
|
|
32
|
+
s as sepolia
|
|
20
33
|
};
|
package/dist/index14.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 f=require("./index15.cjs"),m=require("./index16.cjs"),k=require("./index17.cjs");async function B(t,{blockHash:o,blockNumber:r,blockTag:l,includeTransactions:i}={}){var c,s,u;const d=l??"latest",n=i??!1,a=r!==void 0?m.numberToHex(r):void 0;let e=null;if(o?e=await t.request({method:"eth_getBlockByHash",params:[o,n]},{dedupe:!0}):e=await t.request({method:"eth_getBlockByNumber",params:[a||d,n]},{dedupe:!!a}),!e)throw new f.BlockNotFoundError({blockHash:o,blockNumber:r});return(((u=(s=(c=t.chain)==null?void 0:c.formatters)==null?void 0:s.block)==null?void 0:u.format)||k.formatBlock)(e)}exports.getBlock=B;
|
package/dist/index14.js
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { BlockNotFoundError as i } from "./index15.js";
|
|
2
|
+
import { numberToHex as l } from "./index16.js";
|
|
3
|
+
import { formatBlock as p } from "./index17.js";
|
|
4
|
+
async function T(e, { blockHash: t, blockNumber: r, blockTag: f, includeTransactions: u } = {}) {
|
|
5
|
+
var m, s, c;
|
|
6
|
+
const d = f ?? "latest", a = u ?? !1, n = r !== void 0 ? l(r) : void 0;
|
|
7
|
+
let o = null;
|
|
8
|
+
if (t ? o = await e.request({
|
|
9
|
+
method: "eth_getBlockByHash",
|
|
10
|
+
params: [t, a]
|
|
11
|
+
}, { dedupe: !0 }) : o = await e.request({
|
|
12
|
+
method: "eth_getBlockByNumber",
|
|
13
|
+
params: [n || d, a]
|
|
14
|
+
}, { dedupe: !!n }), !o)
|
|
15
|
+
throw new i({ blockHash: t, blockNumber: r });
|
|
16
|
+
return (((c = (s = (m = e.chain) == null ? void 0 : m.formatters) == null ? void 0 : s.block) == null ? void 0 : c.format) || p)(o);
|
|
7
17
|
}
|
|
8
18
|
export {
|
|
9
|
-
|
|
19
|
+
T as getBlock
|
|
10
20
|
};
|
package/dist/index15.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 t=require("./index34.cjs");class n extends t.BaseError{constructor({blockHash:r,blockNumber:e}){let o="Block";r&&(o=`Block at hash "${r}"`),e&&(o=`Block at number "${e}"`),super(`${o} could not be found.`,{name:"BlockNotFoundError"})}}exports.BlockNotFoundError=n;
|
package/dist/index15.js
CHANGED
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
t ? o ? n = (1n << BigInt(t) * 8n - 1n) - 1n : n = 2n ** (BigInt(t) * 8n) - 1n : typeof i == "number" && (n = BigInt(Number.MAX_SAFE_INTEGER));
|
|
7
|
-
const f = typeof n == "bigint" && o ? -n - 1n : 0;
|
|
8
|
-
if (n && e > n || e < f) {
|
|
9
|
-
const r = typeof i == "bigint" ? "n" : "";
|
|
10
|
-
throw new s({
|
|
11
|
-
max: n ? `${n}${r}` : void 0,
|
|
12
|
-
min: `${f}${r}`,
|
|
13
|
-
signed: o,
|
|
14
|
-
size: t,
|
|
15
|
-
value: `${i}${r}`
|
|
16
|
-
});
|
|
1
|
+
import { BaseError as e } from "./index34.js";
|
|
2
|
+
class d extends e {
|
|
3
|
+
constructor({ blockHash: r, blockNumber: t }) {
|
|
4
|
+
let o = "Block";
|
|
5
|
+
r && (o = `Block at hash "${r}"`), t && (o = `Block at number "${t}"`), super(`${o} could not be found.`, { name: "BlockNotFoundError" });
|
|
17
6
|
}
|
|
18
|
-
const g = `0x${(o && e < 0 ? (1n << BigInt(t * 8)) + BigInt(e) : e).toString(16)}`;
|
|
19
|
-
return t ? u(g, { size: t }) : g;
|
|
20
7
|
}
|
|
21
8
|
export {
|
|
22
|
-
|
|
9
|
+
d as BlockNotFoundError
|
|
23
10
|
};
|
package/dist/index16.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("./index32.cjs"),c=require("./index33.cjs");function m(i,f={}){const{signed:r,size:e}=f,t=BigInt(i);let n;e?r?n=(1n<<BigInt(e)*8n-1n)-1n:n=2n**(BigInt(e)*8n)-1n:typeof i=="number"&&(n=BigInt(Number.MAX_SAFE_INTEGER));const u=typeof n=="bigint"&&r?-n-1n:0;if(n&&t>n||t<u){const o=typeof i=="bigint"?"n":"";throw new s.IntegerOutOfRangeError({max:n?`${n}${o}`:void 0,min:`${u}${o}`,signed:r,size:e,value:`${i}${o}`})}const g=`0x${(r&&t<0?(1n<<BigInt(e*8))+BigInt(t):t).toString(16)}`;return e?c.pad(g,{size:e}):g}exports.numberToHex=m;
|
package/dist/index16.js
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
totalDifficulty: e.totalDifficulty ? BigInt(e.totalDifficulty) : null
|
|
21
|
-
};
|
|
1
|
+
import { IntegerOutOfRangeError as s } from "./index32.js";
|
|
2
|
+
import { pad as u } from "./index33.js";
|
|
3
|
+
function x(i, m = {}) {
|
|
4
|
+
const { signed: o, size: t } = m, e = BigInt(i);
|
|
5
|
+
let n;
|
|
6
|
+
t ? o ? n = (1n << BigInt(t) * 8n - 1n) - 1n : n = 2n ** (BigInt(t) * 8n) - 1n : typeof i == "number" && (n = BigInt(Number.MAX_SAFE_INTEGER));
|
|
7
|
+
const f = typeof n == "bigint" && o ? -n - 1n : 0;
|
|
8
|
+
if (n && e > n || e < f) {
|
|
9
|
+
const r = typeof i == "bigint" ? "n" : "";
|
|
10
|
+
throw new s({
|
|
11
|
+
max: n ? `${n}${r}` : void 0,
|
|
12
|
+
min: `${f}${r}`,
|
|
13
|
+
signed: o,
|
|
14
|
+
size: t,
|
|
15
|
+
value: `${i}${r}`
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const g = `0x${(o && e < 0 ? (1n << BigInt(t * 8)) + BigInt(e) : e).toString(16)}`;
|
|
19
|
+
return t ? u(g, { size: t }) : g;
|
|
22
20
|
}
|
|
23
21
|
export {
|
|
24
|
-
|
|
22
|
+
x as numberToHex
|
|
25
23
|
};
|
package/dist/index17.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 i=require("./index22.cjs");function a(e){var s;const t=(s=e.transactions)==null?void 0:s.map(n=>typeof n=="string"?n:i.formatTransaction(n));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}exports.formatBlock=a;
|
package/dist/index17.js
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { formatTransaction as t } from "./index22.js";
|
|
2
|
+
function u(e) {
|
|
3
|
+
var s;
|
|
4
|
+
const i = (s = e.transactions) == null ? void 0 : s.map((n) => typeof n == "string" ? n : t(n));
|
|
5
|
+
return {
|
|
6
|
+
...e,
|
|
7
|
+
baseFeePerGas: e.baseFeePerGas ? BigInt(e.baseFeePerGas) : null,
|
|
8
|
+
blobGasUsed: e.blobGasUsed ? BigInt(e.blobGasUsed) : void 0,
|
|
9
|
+
difficulty: e.difficulty ? BigInt(e.difficulty) : void 0,
|
|
10
|
+
excessBlobGas: e.excessBlobGas ? BigInt(e.excessBlobGas) : void 0,
|
|
11
|
+
gasLimit: e.gasLimit ? BigInt(e.gasLimit) : void 0,
|
|
12
|
+
gasUsed: e.gasUsed ? BigInt(e.gasUsed) : void 0,
|
|
13
|
+
hash: e.hash ? e.hash : null,
|
|
14
|
+
logsBloom: e.logsBloom ? e.logsBloom : null,
|
|
15
|
+
nonce: e.nonce ? e.nonce : null,
|
|
16
|
+
number: e.number ? BigInt(e.number) : null,
|
|
17
|
+
size: e.size ? BigInt(e.size) : void 0,
|
|
18
|
+
timestamp: e.timestamp ? BigInt(e.timestamp) : void 0,
|
|
19
|
+
transactions: i,
|
|
20
|
+
totalDifficulty: e.totalDifficulty ? BigInt(e.totalDifficulty) : null
|
|
21
|
+
};
|
|
8
22
|
}
|
|
9
23
|
export {
|
|
10
|
-
u as
|
|
24
|
+
u as formatBlock
|
|
11
25
|
};
|
package/dist/index18.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 o=require("./index19.cjs"),r=e=>`blockNumber.${e}`;async function u(e,{cacheTime:c=e.cacheTime}={}){const t=await o.withCache(()=>e.request({method:"eth_blockNumber"}),{cacheKey:r(e.uid),cacheTime:c});return BigInt(t)}exports.getBlockNumber=u;
|
package/dist/index18.js
CHANGED
|
@@ -1,34 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
clear: () => {
|
|
10
|
-
n.clear(), e.clear();
|
|
11
|
-
},
|
|
12
|
-
promise: n,
|
|
13
|
-
response: e
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
async function l(o, { cacheKey: a, cacheTime: n = Number.POSITIVE_INFINITY }) {
|
|
17
|
-
const e = p(a), s = e.response.get();
|
|
18
|
-
if (s && n > 0 && (/* @__PURE__ */ new Date()).getTime() - s.created.getTime() < n)
|
|
19
|
-
return s.data;
|
|
20
|
-
let t = e.promise.get();
|
|
21
|
-
t || (t = o(), e.promise.set(t));
|
|
22
|
-
try {
|
|
23
|
-
const r = await t;
|
|
24
|
-
return e.response.set({ created: /* @__PURE__ */ new Date(), data: r }), r;
|
|
25
|
-
} finally {
|
|
26
|
-
e.promise.clear();
|
|
27
|
-
}
|
|
1
|
+
import { withCache as t } from "./index19.js";
|
|
2
|
+
const r = (e) => `blockNumber.${e}`;
|
|
3
|
+
async function u(e, { cacheTime: c = e.cacheTime } = {}) {
|
|
4
|
+
const o = await t(() => e.request({
|
|
5
|
+
method: "eth_blockNumber"
|
|
6
|
+
}), { cacheKey: r(e.uid), cacheTime: c });
|
|
7
|
+
return BigInt(o);
|
|
28
8
|
}
|
|
29
9
|
export {
|
|
30
|
-
|
|
31
|
-
i as promiseCache,
|
|
32
|
-
c as responseCache,
|
|
33
|
-
l as withCache
|
|
10
|
+
u as getBlockNumber
|
|
34
11
|
};
|
package/dist/index19.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 i=new Map,c=new Map;function p(o){const a=(s,t)=>({clear:()=>t.delete(s),get:()=>t.get(s),set:n=>t.set(s,n)}),r=a(o,i),e=a(o,c);return{clear:()=>{r.clear(),e.clear()},promise:r,response:e}}async function l(o,{cacheKey:a,cacheTime:r=Number.POSITIVE_INFINITY}){const e=p(a),s=e.response.get();if(s&&r>0&&new Date().getTime()-s.created.getTime()<r)return s.data;let t=e.promise.get();t||(t=o(),e.promise.set(t));try{const n=await t;return e.response.set({created:new Date,data:n}),n}finally{e.promise.clear()}}exports.getCache=p;exports.promiseCache=i;exports.responseCache=c;exports.withCache=l;
|
package/dist/index19.js
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
|
|
1
|
+
const i = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map();
|
|
2
|
+
function p(o) {
|
|
3
|
+
const a = (s, t) => ({
|
|
4
|
+
clear: () => t.delete(s),
|
|
5
|
+
get: () => t.get(s),
|
|
6
|
+
set: (r) => t.set(s, r)
|
|
7
|
+
}), n = a(o, i), e = a(o, c);
|
|
8
|
+
return {
|
|
9
|
+
clear: () => {
|
|
10
|
+
n.clear(), e.clear();
|
|
11
|
+
},
|
|
12
|
+
promise: n,
|
|
13
|
+
response: e
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
async function l(o, { cacheKey: a, cacheTime: n = Number.POSITIVE_INFINITY }) {
|
|
17
|
+
const e = p(a), s = e.response.get();
|
|
18
|
+
if (s && n > 0 && (/* @__PURE__ */ new Date()).getTime() - s.created.getTime() < n)
|
|
19
|
+
return s.data;
|
|
20
|
+
let t = e.promise.get();
|
|
21
|
+
t || (t = o(), e.promise.set(t));
|
|
22
|
+
try {
|
|
23
|
+
const r = await t;
|
|
24
|
+
return e.response.set({ created: /* @__PURE__ */ new Date(), data: r }), r;
|
|
25
|
+
} finally {
|
|
26
|
+
e.promise.clear();
|
|
27
|
+
}
|
|
26
28
|
}
|
|
27
29
|
export {
|
|
28
|
-
|
|
30
|
+
p as getCache,
|
|
31
|
+
i as promiseCache,
|
|
32
|
+
c as responseCache,
|
|
33
|
+
l as withCache
|
|
29
34
|
};
|
package/dist/index20.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 T=require("./index21.cjs"),u=require("./index16.cjs"),g=require("./index22.cjs");async function l(t,{blockHash:a,blockNumber:n,blockTag:f,hash:r,index:o}){var c,d,m;const s=f||"latest",i=n!==void 0?u.numberToHex(n):void 0;let e=null;if(r?e=await t.request({method:"eth_getTransactionByHash",params:[r]},{dedupe:!0}):a?e=await t.request({method:"eth_getTransactionByBlockHashAndIndex",params:[a,u.numberToHex(o)]},{dedupe:!0}):(i||s)&&(e=await t.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[i||s,u.numberToHex(o)]},{dedupe:!!i})),!e)throw new T.TransactionNotFoundError({blockHash:a,blockNumber:n,blockTag:s,hash:r,index:o});return(((m=(d=(c=t.chain)==null?void 0:c.formatters)==null?void 0:d.transaction)==null?void 0:m.format)||g.formatTransaction)(e)}exports.getTransaction=l;
|
package/dist/index20.js
CHANGED
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { TransactionNotFoundError as p } from "./index21.js";
|
|
2
|
+
import { numberToHex as i } from "./index16.js";
|
|
3
|
+
import { formatTransaction as T } from "./index22.js";
|
|
4
|
+
async function h(e, { blockHash: a, blockNumber: r, blockTag: c, hash: o, index: n }) {
|
|
5
|
+
var d, f, u;
|
|
6
|
+
const s = c || "latest", m = r !== void 0 ? i(r) : void 0;
|
|
7
|
+
let t = null;
|
|
8
|
+
if (o ? t = await e.request({
|
|
9
|
+
method: "eth_getTransactionByHash",
|
|
10
|
+
params: [o]
|
|
11
|
+
}, { dedupe: !0 }) : a ? t = await e.request({
|
|
12
|
+
method: "eth_getTransactionByBlockHashAndIndex",
|
|
13
|
+
params: [a, i(n)]
|
|
14
|
+
}, { dedupe: !0 }) : (m || s) && (t = await e.request({
|
|
15
|
+
method: "eth_getTransactionByBlockNumberAndIndex",
|
|
16
|
+
params: [m || s, i(n)]
|
|
17
|
+
}, { dedupe: !!m })), !t)
|
|
18
|
+
throw new p({
|
|
19
|
+
blockHash: a,
|
|
20
|
+
blockNumber: r,
|
|
21
|
+
blockTag: s,
|
|
22
|
+
hash: o,
|
|
23
|
+
index: n
|
|
7
24
|
});
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
class d extends r {
|
|
11
|
-
constructor({ hash: t }) {
|
|
12
|
-
super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`, {
|
|
13
|
-
name: "TransactionReceiptNotFoundError"
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
class T extends r {
|
|
18
|
-
constructor({ hash: t }) {
|
|
19
|
-
super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`, { name: "WaitForTransactionReceiptTimeoutError" });
|
|
20
|
-
}
|
|
25
|
+
return (((u = (f = (d = e.chain) == null ? void 0 : d.formatters) == null ? void 0 : f.transaction) == null ? void 0 : u.format) || T)(t);
|
|
21
26
|
}
|
|
22
27
|
export {
|
|
23
|
-
|
|
24
|
-
d as TransactionReceiptNotFoundError,
|
|
25
|
-
T as WaitForTransactionReceiptTimeoutError
|
|
28
|
+
h as getTransaction
|
|
26
29
|
};
|
package/dist/index21.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 n=require("./index34.cjs");class c extends n.BaseError{constructor({blockHash:r,blockNumber:a,blockTag:i,hash:s,index:o}){let t="Transaction";i&&o!==void 0&&(t=`Transaction at block time "${i}" at index "${o}"`),r&&o!==void 0&&(t=`Transaction at block hash "${r}" at index "${o}"`),a&&o!==void 0&&(t=`Transaction at block number "${a}" at index "${o}"`),s&&(t=`Transaction with hash "${s}"`),super(`${t} could not be found.`,{name:"TransactionNotFoundError"})}}class u extends n.BaseError{constructor({hash:r}){super(`Transaction receipt with hash "${r}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class d extends n.BaseError{constructor({hash:r}){super(`Timed out while waiting for transaction with hash "${r}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}exports.TransactionNotFoundError=c;exports.TransactionReceiptNotFoundError=u;exports.WaitForTransactionReceiptTimeoutError=d;
|
package/dist/index21.js
CHANGED
|
@@ -1,55 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
gasPrice: e.gasPrice ? BigInt(e.gasPrice) : void 0,
|
|
17
|
-
maxFeePerBlobGas: e.maxFeePerBlobGas ? BigInt(e.maxFeePerBlobGas) : void 0,
|
|
18
|
-
maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0,
|
|
19
|
-
maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0,
|
|
20
|
-
nonce: e.nonce ? r(e.nonce) : void 0,
|
|
21
|
-
to: e.to ? e.to : null,
|
|
22
|
-
transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
|
|
23
|
-
type: e.type ? y[e.type] : void 0,
|
|
24
|
-
typeHex: e.type ? e.type : void 0,
|
|
25
|
-
value: e.value ? BigInt(e.value) : void 0,
|
|
26
|
-
v: e.v ? BigInt(e.v) : void 0
|
|
27
|
-
};
|
|
28
|
-
return e.authorizationList && (d.authorizationList = i(e.authorizationList)), d.yParity = (() => {
|
|
29
|
-
if (e.yParity)
|
|
30
|
-
return Number(e.yParity);
|
|
31
|
-
if (typeof d.v == "bigint") {
|
|
32
|
-
if (d.v === 0n || d.v === 27n)
|
|
33
|
-
return 0;
|
|
34
|
-
if (d.v === 1n || d.v === 28n)
|
|
35
|
-
return 1;
|
|
36
|
-
if (d.v >= 35n)
|
|
37
|
-
return d.v % 2n === 0n ? 1 : 0;
|
|
38
|
-
}
|
|
39
|
-
})(), d.type === "legacy" && (delete d.accessList, delete d.maxFeePerBlobGas, delete d.maxFeePerGas, delete d.maxPriorityFeePerGas, delete d.yParity), d.type === "eip2930" && (delete d.maxFeePerBlobGas, delete d.maxFeePerGas, delete d.maxPriorityFeePerGas), d.type === "eip1559" && delete d.maxFeePerBlobGas, d;
|
|
1
|
+
import { BaseError as r } from "./index34.js";
|
|
2
|
+
class u extends r {
|
|
3
|
+
constructor({ blockHash: t, blockNumber: e, blockTag: i, hash: s, index: o }) {
|
|
4
|
+
let n = "Transaction";
|
|
5
|
+
i && o !== void 0 && (n = `Transaction at block time "${i}" at index "${o}"`), t && o !== void 0 && (n = `Transaction at block hash "${t}" at index "${o}"`), e && o !== void 0 && (n = `Transaction at block number "${e}" at index "${o}"`), s && (n = `Transaction with hash "${s}"`), super(`${n} could not be found.`, {
|
|
6
|
+
name: "TransactionNotFoundError"
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
class d extends r {
|
|
11
|
+
constructor({ hash: t }) {
|
|
12
|
+
super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`, {
|
|
13
|
+
name: "TransactionReceiptNotFoundError"
|
|
14
|
+
});
|
|
15
|
+
}
|
|
40
16
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
s: d.s,
|
|
46
|
-
chainId: Number(d.chainId),
|
|
47
|
-
nonce: Number(d.nonce),
|
|
48
|
-
...typeof d.yParity < "u" ? { yParity: Number(d.yParity) } : {},
|
|
49
|
-
...typeof d.v < "u" && typeof d.yParity > "u" ? { v: Number(d.v) } : {}
|
|
50
|
-
}));
|
|
17
|
+
class T extends r {
|
|
18
|
+
constructor({ hash: t }) {
|
|
19
|
+
super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`, { name: "WaitForTransactionReceiptTimeoutError" });
|
|
20
|
+
}
|
|
51
21
|
}
|
|
52
22
|
export {
|
|
53
|
-
|
|
54
|
-
|
|
23
|
+
u as TransactionNotFoundError,
|
|
24
|
+
d as TransactionReceiptNotFoundError,
|
|
25
|
+
T as WaitForTransactionReceiptTimeoutError
|
|
55
26
|
};
|
package/dist/index22.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 r=require("./index26.cjs"),i={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function u(e){const d={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?r.hexToNumber(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?r.hexToNumber(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?i[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(d.authorizationList=l(e.authorizationList)),d.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof d.v=="bigint"){if(d.v===0n||d.v===27n)return 0;if(d.v===1n||d.v===28n)return 1;if(d.v>=35n)return d.v%2n===0n?1:0}})(),d.type==="legacy"&&(delete d.accessList,delete d.maxFeePerBlobGas,delete d.maxFeePerGas,delete d.maxPriorityFeePerGas,delete d.yParity),d.type==="eip2930"&&(delete d.maxFeePerBlobGas,delete d.maxFeePerGas,delete d.maxPriorityFeePerGas),d.type==="eip1559"&&delete d.maxFeePerBlobGas,d}function l(e){return e.map(d=>({contractAddress:d.address,chainId:Number(d.chainId),nonce:Number(d.nonce),r:d.r,s:d.s,yParity:Number(d.yParity)}))}exports.formatTransaction=u;exports.transactionType=i;
|