@gardenfi/orderbook 0.2.0-beta.11 → 0.2.0-beta.13
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/index.cjs +1 -1
- package/dist/index.js +15 -15
- package/dist/index10.cjs +1 -0
- package/dist/index10.js +32 -0
- package/dist/index11.cjs +1 -0
- package/dist/index11.js +55 -0
- package/dist/index12.cjs +1 -0
- package/dist/index12.js +9 -0
- package/dist/index13.cjs +1 -0
- package/dist/index13.js +11 -0
- package/dist/index14.cjs +1 -0
- package/dist/index14.js +11 -0
- package/dist/index15.cjs +1 -0
- package/dist/index15.js +15 -0
- package/dist/index16.cjs +1 -0
- package/dist/index16.js +39 -0
- package/dist/index17.cjs +1 -0
- package/dist/index17.js +44 -0
- package/dist/index18.cjs +1 -0
- package/dist/index18.js +26 -0
- package/dist/index19.cjs +1 -0
- package/dist/index19.js +28 -0
- package/dist/index20.cjs +1 -0
- package/dist/index20.js +57 -0
- package/dist/index21.cjs +1 -0
- package/dist/index21.js +30 -0
- package/dist/index22.cjs +1 -0
- package/dist/index22.js +15 -0
- package/dist/index23.cjs +1 -0
- package/dist/index23.js +14 -0
- package/dist/index24.cjs +1 -0
- package/dist/index24.js +6 -0
- package/dist/index25.cjs +1 -0
- package/dist/index25.js +48 -0
- package/dist/index26.cjs +1 -0
- package/dist/index26.js +45 -0
- package/dist/index27.cjs +1 -0
- package/dist/index27.js +174 -0
- package/dist/index28.cjs +1 -0
- package/dist/index28.js +15 -0
- package/dist/index29.cjs +1 -0
- package/dist/index29.js +7 -0
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +26 -10
- package/dist/index30.cjs +1 -0
- package/dist/index30.js +19 -0
- package/dist/index31.cjs +1 -0
- package/dist/index31.js +14 -0
- package/dist/index32.cjs +2 -0
- package/dist/index32.js +62 -0
- package/dist/index33.cjs +1 -0
- package/dist/index33.js +24 -0
- package/dist/index34.cjs +1 -0
- package/dist/index34.js +16 -0
- package/dist/index35.cjs +1 -0
- package/dist/index35.js +37 -0
- package/dist/index36.cjs +1 -0
- package/dist/index36.js +130 -0
- package/dist/index37.cjs +1 -0
- package/dist/index37.js +58 -0
- package/dist/index38.cjs +2 -0
- package/dist/index38.js +45 -0
- package/dist/index39.cjs +1 -0
- package/dist/index39.js +11 -0
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +1 -1
- package/dist/index40.cjs +1 -0
- package/dist/index40.js +13 -0
- package/dist/index41.cjs +1 -0
- package/dist/index41.js +14 -0
- package/dist/index42.cjs +1 -0
- package/dist/index42.js +16 -0
- package/dist/index43.cjs +1 -0
- package/dist/index43.js +9 -0
- package/dist/index44.cjs +1 -0
- package/dist/index44.js +20 -0
- package/dist/index45.cjs +1 -0
- package/dist/index45.js +81 -0
- package/dist/index46.cjs +1 -0
- package/dist/index46.js +17 -0
- package/dist/index47.cjs +1 -0
- package/dist/index47.js +21 -0
- package/dist/index48.cjs +1 -0
- package/dist/index48.js +6 -0
- package/dist/index49.cjs +1 -0
- package/dist/index49.js +4 -0
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +1 -9
- package/dist/index50.cjs +1 -0
- package/dist/index50.js +4 -0
- package/dist/index51.cjs +1 -0
- package/dist/index51.js +9 -0
- package/dist/index52.cjs +2 -0
- package/dist/index52.js +37 -0
- package/dist/index53.cjs +1 -0
- package/dist/index53.js +8 -0
- package/dist/index54.cjs +1 -0
- package/dist/index54.js +9 -0
- package/dist/index55.cjs +1 -0
- package/dist/index55.js +15 -0
- package/dist/index56.cjs +1 -0
- package/dist/index56.js +9 -0
- package/dist/index57.cjs +1 -0
- package/dist/index57.js +35 -0
- package/dist/index58.cjs +1 -0
- package/dist/index58.js +4 -0
- package/dist/index59.cjs +1 -0
- package/dist/index59.js +40 -0
- package/dist/index60.cjs +1 -0
- package/dist/index60.js +31 -0
- package/dist/index61.cjs +1 -0
- package/dist/index61.js +23 -0
- package/dist/index62.cjs +1 -0
- package/dist/index62.js +9 -0
- package/dist/index63.cjs +1 -0
- package/dist/index63.js +115 -0
- package/dist/index64.cjs +1 -0
- package/dist/index64.js +7 -0
- package/dist/index65.cjs +1 -0
- package/dist/index65.js +13 -0
- package/dist/index66.cjs +1 -0
- package/dist/index66.js +107 -0
- package/dist/index67.cjs +1 -0
- package/dist/index67.js +7 -0
- package/dist/index68.cjs +1 -0
- package/dist/index68.js +64 -0
- package/dist/index69.cjs +1 -0
- package/dist/index69.js +37 -0
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +32 -7
- package/dist/index70.cjs +1 -0
- package/dist/index70.js +32 -0
- package/dist/index71.cjs +1 -0
- package/dist/index71.js +21 -0
- package/dist/index8.cjs +1 -0
- package/dist/index8.js +27 -0
- package/dist/index9.cjs +1 -0
- package/dist/index9.js +33 -0
- package/dist/src/index.d.ts +2 -2
- package/dist/src/lib/asset.d.ts +5 -2
- package/dist/src/lib/constants.d.ts +0 -1
- package/package.json +2 -2
package/dist/index.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("./index2.cjs"),e=require("./index3.cjs"),o=require("./index4.cjs"),r=require("./index5.cjs");exports.Orderbook=t.Orderbook;exports.BlockchainType=e.BlockchainType;exports.ChainToID=e.ChainToID;exports.Chains=e.Chains;exports.getBlockchainType=e.getBlockchainType;exports.isBitcoin=e.isBitcoin;exports.isEVM=e.isEVM;exports.isMainnet=e.isMainnet;exports.OrdersProvider=o.OrdersProvider;exports.ArbitrumLocalnet=r.ArbitrumLocalnet;exports.EthereumLocalnet=r.EthereumLocalnet;exports.SupportedAssets=r.SupportedAssets;exports.WBTCArbitrumLocalnetAsset=r.WBTCArbitrumLocalnetAsset;exports.WBTCEthereumLocalnetAsset=r.WBTCEthereumLocalnetAsset;
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Orderbook as
|
|
2
|
-
import { BlockchainType as s, Chains as
|
|
1
|
+
import { Orderbook as o } from "./index2.js";
|
|
2
|
+
import { BlockchainType as i, ChainToID as s, Chains as n, getBlockchainType as a, isBitcoin as c, isEVM as m, isMainnet as p } from "./index3.js";
|
|
3
3
|
import { OrdersProvider as l } from "./index4.js";
|
|
4
|
-
import { ArbitrumLocalnet as
|
|
4
|
+
import { ArbitrumLocalnet as A, EthereumLocalnet as B, SupportedAssets as T, WBTCArbitrumLocalnetAsset as d, WBTCEthereumLocalnetAsset as f } from "./index5.js";
|
|
5
5
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
A as ArbitrumLocalnet,
|
|
7
|
+
i as BlockchainType,
|
|
8
|
+
s as ChainToID,
|
|
9
|
+
n as Chains,
|
|
10
|
+
B as EthereumLocalnet,
|
|
11
|
+
o as Orderbook,
|
|
11
12
|
l as OrdersProvider,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
n as getBlockchainType,
|
|
13
|
+
T as SupportedAssets,
|
|
14
|
+
d as WBTCArbitrumLocalnetAsset,
|
|
15
|
+
f as WBTCEthereumLocalnetAsset,
|
|
16
|
+
a as getBlockchainType,
|
|
17
17
|
c as isBitcoin,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
m as isEVM,
|
|
19
|
+
p as isMainnet
|
|
20
20
|
};
|
package/dist/index10.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index13.cjs"),a=e.defineChain({id:421614,name:"Arbitrum Sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://sepolia.arbiscan.io",apiUrl:"https://api-sepolia.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:81930}},testnet:!0});exports.arbitrumSepolia=a;
|
package/dist/index10.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineChain as a } from "./index13.js";
|
|
2
|
+
const e = /* @__PURE__ */ a({
|
|
3
|
+
id: 421614,
|
|
4
|
+
name: "Arbitrum Sepolia",
|
|
5
|
+
nativeCurrency: {
|
|
6
|
+
name: "Arbitrum Sepolia Ether",
|
|
7
|
+
symbol: "ETH",
|
|
8
|
+
decimals: 18
|
|
9
|
+
},
|
|
10
|
+
rpcUrls: {
|
|
11
|
+
default: {
|
|
12
|
+
http: ["https://sepolia-rollup.arbitrum.io/rpc"]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
blockExplorers: {
|
|
16
|
+
default: {
|
|
17
|
+
name: "Arbiscan",
|
|
18
|
+
url: "https://sepolia.arbiscan.io",
|
|
19
|
+
apiUrl: "https://api-sepolia.arbiscan.io/api"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
contracts: {
|
|
23
|
+
multicall3: {
|
|
24
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
25
|
+
blockCreated: 81930
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
testnet: !0
|
|
29
|
+
});
|
|
30
|
+
export {
|
|
31
|
+
e as arbitrumSepolia
|
|
32
|
+
};
|
package/dist/index11.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index14.cjs"),s=require("./index13.cjs"),e=11155111,t=s.defineChain({...a.chainConfig,id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://sepolia.basescan.org",apiUrl:"https://api-sepolia.basescan.org/api"}},contracts:{...a.chainConfig.contracts,disputeGameFactory:{[e]:{address:"0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1"}},l2OutputOracle:{[e]:{address:"0x84457ca9D0163FbC4bbfe4Dfbb20ba46e48DF254"}},portal:{[e]:{address:"0x49f53e41452c74589e85ca1677426ba426459e85",blockCreated:4446677}},l1StandardBridge:{[e]:{address:"0xfd0Bf71F60660E2f608ed56e1659C450eB113120",blockCreated:4446677}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1059647}},testnet:!0,sourceId:e});exports.baseSepolia=t;
|
package/dist/index11.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { chainConfig as a } from "./index14.js";
|
|
2
|
+
import { defineChain as s } from "./index13.js";
|
|
3
|
+
const e = 11155111, o = /* @__PURE__ */ s({
|
|
4
|
+
...a,
|
|
5
|
+
id: 84532,
|
|
6
|
+
network: "base-sepolia",
|
|
7
|
+
name: "Base Sepolia",
|
|
8
|
+
nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
|
|
9
|
+
rpcUrls: {
|
|
10
|
+
default: {
|
|
11
|
+
http: ["https://sepolia.base.org"]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
blockExplorers: {
|
|
15
|
+
default: {
|
|
16
|
+
name: "Basescan",
|
|
17
|
+
url: "https://sepolia.basescan.org",
|
|
18
|
+
apiUrl: "https://api-sepolia.basescan.org/api"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
contracts: {
|
|
22
|
+
...a.contracts,
|
|
23
|
+
disputeGameFactory: {
|
|
24
|
+
[e]: {
|
|
25
|
+
address: "0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
l2OutputOracle: {
|
|
29
|
+
[e]: {
|
|
30
|
+
address: "0x84457ca9D0163FbC4bbfe4Dfbb20ba46e48DF254"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
portal: {
|
|
34
|
+
[e]: {
|
|
35
|
+
address: "0x49f53e41452c74589e85ca1677426ba426459e85",
|
|
36
|
+
blockCreated: 4446677
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
l1StandardBridge: {
|
|
40
|
+
[e]: {
|
|
41
|
+
address: "0xfd0Bf71F60660E2f608ed56e1659C450eB113120",
|
|
42
|
+
blockCreated: 4446677
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
multicall3: {
|
|
46
|
+
address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
47
|
+
blockCreated: 1059647
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
testnet: !0,
|
|
51
|
+
sourceId: e
|
|
52
|
+
});
|
|
53
|
+
export {
|
|
54
|
+
o as baseSepolia
|
|
55
|
+
};
|
package/dist/index12.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=(n,o,t)=>{const r=n.endpoint(o);return t&&Object.entries(t).forEach(([c,e])=>{e!==void 0&&r.searchParams.append(c,e.toString())}),r};exports.ConstructUrl=i;
|
package/dist/index12.js
ADDED
package/dist/index13.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function n(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}exports.defineChain=n;
|
package/dist/index13.js
ADDED
package/dist/index14.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index15.cjs"),e=require("./index16.cjs"),t=require("./index17.cjs"),s={contracts:r.contracts,formatters:e.formatters,serializers:t.serializers};exports.chainConfig=s;
|
package/dist/index14.js
ADDED
package/dist/index15.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}};exports.contracts=s;
|
package/dist/index15.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const s = {
|
|
2
|
+
gasPriceOracle: { address: "0x420000000000000000000000000000000000000F" },
|
|
3
|
+
l1Block: { address: "0x4200000000000000000000000000000000000015" },
|
|
4
|
+
l2CrossDomainMessenger: {
|
|
5
|
+
address: "0x4200000000000000000000000000000000000007"
|
|
6
|
+
},
|
|
7
|
+
l2Erc721Bridge: { address: "0x4200000000000000000000000000000000000014" },
|
|
8
|
+
l2StandardBridge: { address: "0x4200000000000000000000000000000000000010" },
|
|
9
|
+
l2ToL1MessagePasser: {
|
|
10
|
+
address: "0x4200000000000000000000000000000000000016"
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
s as contracts
|
|
15
|
+
};
|
package/dist/index16.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index18.cjs"),c=require("./index19.cjs"),r=require("./index20.cjs"),l=require("./index21.cjs"),a={block:c.defineBlock({format(e){var s;return{transactions:(s=e.transactions)==null?void 0:s.map(t=>{if(typeof t=="string")return t;const i=r.formatTransaction(t);return i.typeHex==="0x7e"&&(i.isSystemTx=t.isSystemTx,i.mint=t.mint?o.hexToBigInt(t.mint):void 0,i.sourceHash=t.sourceHash,i.type="deposit"),i}),stateRoot:e.stateRoot}}}),transaction:r.defineTransaction({format(e){const n={};return e.type==="0x7e"&&(n.isSystemTx=e.isSystemTx,n.mint=e.mint?o.hexToBigInt(e.mint):void 0,n.sourceHash=e.sourceHash,n.type="deposit"),n}}),transactionReceipt:l.defineTransactionReceipt({format(e){return{l1GasPrice:e.l1GasPrice?o.hexToBigInt(e.l1GasPrice):null,l1GasUsed:e.l1GasUsed?o.hexToBigInt(e.l1GasUsed):null,l1Fee:e.l1Fee?o.hexToBigInt(e.l1Fee):null,l1FeeScalar:e.l1FeeScalar?Number(e.l1FeeScalar):null}}})};exports.formatters=a;
|
package/dist/index16.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { hexToBigInt as n } from "./index18.js";
|
|
2
|
+
import { defineBlock as s } from "./index19.js";
|
|
3
|
+
import { formatTransaction as m, defineTransaction as l } from "./index20.js";
|
|
4
|
+
import { defineTransactionReceipt as c } from "./index21.js";
|
|
5
|
+
const d = {
|
|
6
|
+
block: /* @__PURE__ */ s({
|
|
7
|
+
format(e) {
|
|
8
|
+
var r;
|
|
9
|
+
return {
|
|
10
|
+
transactions: (r = e.transactions) == null ? void 0 : r.map((t) => {
|
|
11
|
+
if (typeof t == "string")
|
|
12
|
+
return t;
|
|
13
|
+
const i = m(t);
|
|
14
|
+
return i.typeHex === "0x7e" && (i.isSystemTx = t.isSystemTx, i.mint = t.mint ? n(t.mint) : void 0, i.sourceHash = t.sourceHash, i.type = "deposit"), i;
|
|
15
|
+
}),
|
|
16
|
+
stateRoot: e.stateRoot
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}),
|
|
20
|
+
transaction: /* @__PURE__ */ l({
|
|
21
|
+
format(e) {
|
|
22
|
+
const o = {};
|
|
23
|
+
return e.type === "0x7e" && (o.isSystemTx = e.isSystemTx, o.mint = e.mint ? n(e.mint) : void 0, o.sourceHash = e.sourceHash, o.type = "deposit"), o;
|
|
24
|
+
}
|
|
25
|
+
}),
|
|
26
|
+
transactionReceipt: /* @__PURE__ */ c({
|
|
27
|
+
format(e) {
|
|
28
|
+
return {
|
|
29
|
+
l1GasPrice: e.l1GasPrice ? n(e.l1GasPrice) : null,
|
|
30
|
+
l1GasUsed: e.l1GasUsed ? n(e.l1GasUsed) : null,
|
|
31
|
+
l1Fee: e.l1Fee ? n(e.l1Fee) : null,
|
|
32
|
+
l1FeeScalar: e.l1FeeScalar ? Number(e.l1FeeScalar) : null
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
d as formatters
|
|
39
|
+
};
|
package/dist/index17.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index22.cjs"),c=require("./index23.cjs"),T=require("./index24.cjs"),t=require("./index25.cjs"),z=require("./index26.cjs"),H=require("./index27.cjs");function d(e,r){return y(e)?m(e):H.serializeTransaction(e,r)}const q={transaction:d};function m(e){u(e);const{sourceHash:r,data:s,from:l,gas:i,isSystemTx:f,mint:o,to:x,value:n}=e,p=[r,l,x??"0x",o?t.toHex(o):"0x",n?t.toHex(n):"0x",i?t.toHex(i):"0x",f?"0x1":"0x",s??"0x"];return T.concatHex(["0x7e",z.toRlp(p)])}function y(e){return e.type==="deposit"||typeof e.sourceHash<"u"}function u(e){const{from:r,to:s}=e;if(r&&!c.isAddress(r))throw new a.InvalidAddressError({address:r});if(s&&!c.isAddress(s))throw new a.InvalidAddressError({address:s})}exports.assertTransactionDeposit=u;exports.serializeTransaction=d;exports.serializers=q;
|
package/dist/index17.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { InvalidAddressError as a } from "./index22.js";
|
|
2
|
+
import { isAddress as f } from "./index23.js";
|
|
3
|
+
import { concatHex as p } from "./index24.js";
|
|
4
|
+
import { toHex as i } from "./index25.js";
|
|
5
|
+
import { toRlp as x } from "./index26.js";
|
|
6
|
+
import { serializeTransaction as l } from "./index27.js";
|
|
7
|
+
function T(r, e) {
|
|
8
|
+
return h(r) ? z(r) : l(r, e);
|
|
9
|
+
}
|
|
10
|
+
const E = {
|
|
11
|
+
transaction: T
|
|
12
|
+
};
|
|
13
|
+
function z(r) {
|
|
14
|
+
w(r);
|
|
15
|
+
const { sourceHash: e, data: o, from: m, gas: t, isSystemTx: u, mint: s, to: c, value: n } = r, d = [
|
|
16
|
+
e,
|
|
17
|
+
m,
|
|
18
|
+
c ?? "0x",
|
|
19
|
+
s ? i(s) : "0x",
|
|
20
|
+
n ? i(n) : "0x",
|
|
21
|
+
t ? i(t) : "0x",
|
|
22
|
+
u ? "0x1" : "0x",
|
|
23
|
+
o ?? "0x"
|
|
24
|
+
];
|
|
25
|
+
return p([
|
|
26
|
+
"0x7e",
|
|
27
|
+
x(d)
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
function h(r) {
|
|
31
|
+
return r.type === "deposit" || typeof r.sourceHash < "u";
|
|
32
|
+
}
|
|
33
|
+
function w(r) {
|
|
34
|
+
const { from: e, to: o } = r;
|
|
35
|
+
if (e && !f(e))
|
|
36
|
+
throw new a({ address: e });
|
|
37
|
+
if (o && !f(o))
|
|
38
|
+
throw new a({ address: o });
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
w as assertTransactionDeposit,
|
|
42
|
+
T as serializeTransaction,
|
|
43
|
+
E as serializers
|
|
44
|
+
};
|
package/dist/index18.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("./index28.cjs"),r=require("./index29.cjs");function o(e,{size:n}){if(r.size(e)>n)throw new z.SizeOverflowError({givenSize:r.size(e),maxSize:n})}function s(e,n={}){const{signed:u}=n;n.size&&o(e,{size:n.size});const i=BigInt(e);if(!u)return i;const t=(e.length-2)/2,c=(1n<<BigInt(t)*8n-1n)-1n;return i<=c?i:i-BigInt(`0x${"f".padStart(t*2,"f")}`)-1n}function f(e,n={}){return Number(s(e,n))}exports.assertSize=o;exports.hexToBigInt=s;exports.hexToNumber=f;
|
package/dist/index18.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SizeOverflowError as u } from "./index28.js";
|
|
2
|
+
import { size as t } from "./index29.js";
|
|
3
|
+
function s(n, { size: i }) {
|
|
4
|
+
if (t(n) > i)
|
|
5
|
+
throw new u({
|
|
6
|
+
givenSize: t(n),
|
|
7
|
+
maxSize: i
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
function z(n, i = {}) {
|
|
11
|
+
const { signed: o } = i;
|
|
12
|
+
i.size && s(n, { size: i.size });
|
|
13
|
+
const e = BigInt(n);
|
|
14
|
+
if (!o)
|
|
15
|
+
return e;
|
|
16
|
+
const r = (n.length - 2) / 2, f = (1n << BigInt(r) * 8n - 1n) - 1n;
|
|
17
|
+
return e <= f ? e : e - BigInt(`0x${"f".padStart(r * 2, "f")}`) - 1n;
|
|
18
|
+
}
|
|
19
|
+
function g(n, i = {}) {
|
|
20
|
+
return Number(z(n, i));
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
s as assertSize,
|
|
24
|
+
z as hexToBigInt,
|
|
25
|
+
g as hexToNumber
|
|
26
|
+
};
|
package/dist/index19.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index30.cjs"),u=require("./index20.cjs");function i(e){var t;const s=(t=e.transactions)==null?void 0:t.map(n=>typeof n=="string"?n:u.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:s,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const f=a.defineFormatter("block",i);exports.defineBlock=f;exports.formatBlock=i;
|
package/dist/index19.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineFormatter as t } from "./index30.js";
|
|
2
|
+
import { formatTransaction as a } from "./index20.js";
|
|
3
|
+
function f(e) {
|
|
4
|
+
var i;
|
|
5
|
+
const s = (i = e.transactions) == null ? void 0 : i.map((n) => typeof n == "string" ? n : a(n));
|
|
6
|
+
return {
|
|
7
|
+
...e,
|
|
8
|
+
baseFeePerGas: e.baseFeePerGas ? BigInt(e.baseFeePerGas) : null,
|
|
9
|
+
blobGasUsed: e.blobGasUsed ? BigInt(e.blobGasUsed) : void 0,
|
|
10
|
+
difficulty: e.difficulty ? BigInt(e.difficulty) : void 0,
|
|
11
|
+
excessBlobGas: e.excessBlobGas ? BigInt(e.excessBlobGas) : void 0,
|
|
12
|
+
gasLimit: e.gasLimit ? BigInt(e.gasLimit) : void 0,
|
|
13
|
+
gasUsed: e.gasUsed ? BigInt(e.gasUsed) : void 0,
|
|
14
|
+
hash: e.hash ? e.hash : null,
|
|
15
|
+
logsBloom: e.logsBloom ? e.logsBloom : null,
|
|
16
|
+
nonce: e.nonce ? e.nonce : null,
|
|
17
|
+
number: e.number ? BigInt(e.number) : null,
|
|
18
|
+
size: e.size ? BigInt(e.size) : void 0,
|
|
19
|
+
timestamp: e.timestamp ? BigInt(e.timestamp) : void 0,
|
|
20
|
+
transactions: s,
|
|
21
|
+
totalDifficulty: e.totalDifficulty ? BigInt(e.totalDifficulty) : null
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const m = /* @__PURE__ */ t("block", f);
|
|
25
|
+
export {
|
|
26
|
+
m as defineBlock,
|
|
27
|
+
f as formatBlock
|
|
28
|
+
};
|
package/dist/index20.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index18.cjs"),l=require("./index30.cjs"),d={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function u(e){const r={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?i.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?i.hexToNumber(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?d[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&&(r.authorizationList=m(e.authorizationList)),r.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof r.v=="bigint"){if(r.v===0n||r.v===27n)return 0;if(r.v===1n||r.v===28n)return 1;if(r.v>=35n)return r.v%2n===0n?1:0}})(),r.type==="legacy"&&(delete r.accessList,delete r.maxFeePerBlobGas,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas,delete r.yParity),r.type==="eip2930"&&(delete r.maxFeePerBlobGas,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas),r.type==="eip1559"&&delete r.maxFeePerBlobGas,r}const n=l.defineFormatter("transaction",u);function m(e){return e.map(r=>({contractAddress:r.address,chainId:Number(r.chainId),nonce:Number(r.nonce),r:r.r,s:r.s,yParity:Number(r.yParity)}))}exports.defineTransaction=n;exports.formatTransaction=u;exports.transactionType=d;
|
package/dist/index20.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { hexToNumber as r } from "./index18.js";
|
|
2
|
+
import { defineFormatter as i } from "./index30.js";
|
|
3
|
+
const u = {
|
|
4
|
+
"0x0": "legacy",
|
|
5
|
+
"0x1": "eip2930",
|
|
6
|
+
"0x2": "eip1559",
|
|
7
|
+
"0x3": "eip4844",
|
|
8
|
+
"0x4": "eip7702"
|
|
9
|
+
};
|
|
10
|
+
function l(e) {
|
|
11
|
+
const d = {
|
|
12
|
+
...e,
|
|
13
|
+
blockHash: e.blockHash ? e.blockHash : null,
|
|
14
|
+
blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
|
|
15
|
+
chainId: e.chainId ? r(e.chainId) : void 0,
|
|
16
|
+
gas: e.gas ? BigInt(e.gas) : void 0,
|
|
17
|
+
gasPrice: e.gasPrice ? BigInt(e.gasPrice) : void 0,
|
|
18
|
+
maxFeePerBlobGas: e.maxFeePerBlobGas ? BigInt(e.maxFeePerBlobGas) : void 0,
|
|
19
|
+
maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0,
|
|
20
|
+
maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0,
|
|
21
|
+
nonce: e.nonce ? r(e.nonce) : void 0,
|
|
22
|
+
to: e.to ? e.to : null,
|
|
23
|
+
transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
|
|
24
|
+
type: e.type ? u[e.type] : void 0,
|
|
25
|
+
typeHex: e.type ? e.type : void 0,
|
|
26
|
+
value: e.value ? BigInt(e.value) : void 0,
|
|
27
|
+
v: e.v ? BigInt(e.v) : void 0
|
|
28
|
+
};
|
|
29
|
+
return e.authorizationList && (d.authorizationList = m(e.authorizationList)), d.yParity = (() => {
|
|
30
|
+
if (e.yParity)
|
|
31
|
+
return Number(e.yParity);
|
|
32
|
+
if (typeof d.v == "bigint") {
|
|
33
|
+
if (d.v === 0n || d.v === 27n)
|
|
34
|
+
return 0;
|
|
35
|
+
if (d.v === 1n || d.v === 28n)
|
|
36
|
+
return 1;
|
|
37
|
+
if (d.v >= 35n)
|
|
38
|
+
return d.v % 2n === 0n ? 1 : 0;
|
|
39
|
+
}
|
|
40
|
+
})(), 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;
|
|
41
|
+
}
|
|
42
|
+
const P = /* @__PURE__ */ i("transaction", l);
|
|
43
|
+
function m(e) {
|
|
44
|
+
return e.map((d) => ({
|
|
45
|
+
contractAddress: d.address,
|
|
46
|
+
chainId: Number(d.chainId),
|
|
47
|
+
nonce: Number(d.nonce),
|
|
48
|
+
r: d.r,
|
|
49
|
+
s: d.s,
|
|
50
|
+
yParity: Number(d.yParity)
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
P as defineTransaction,
|
|
55
|
+
l as formatTransaction,
|
|
56
|
+
u as transactionType
|
|
57
|
+
};
|
package/dist/index21.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index18.cjs"),o=require("./index30.cjs"),b=require("./index31.cjs"),f=require("./index20.cjs"),l={"0x0":"reverted","0x1":"success"};function u(e){const s={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>b.formatLog(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?d.hexToNumber(e.transactionIndex):null,status:e.status?l[e.status]:null,type:e.type?f.transactionType[e.type]||e.type:null};return e.blobGasPrice&&(s.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(s.blobGasUsed=BigInt(e.blobGasUsed)),s}const g=o.defineFormatter("transactionReceipt",u);exports.defineTransactionReceipt=g;exports.formatTransactionReceipt=u;exports.receiptStatuses=l;
|
package/dist/index21.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { hexToNumber as d } from "./index18.js";
|
|
2
|
+
import { defineFormatter as b } from "./index30.js";
|
|
3
|
+
import { formatLog as m } from "./index31.js";
|
|
4
|
+
import { transactionType as o } from "./index20.js";
|
|
5
|
+
const f = {
|
|
6
|
+
"0x0": "reverted",
|
|
7
|
+
"0x1": "success"
|
|
8
|
+
};
|
|
9
|
+
function r(l) {
|
|
10
|
+
const s = {
|
|
11
|
+
...l,
|
|
12
|
+
blockNumber: l.blockNumber ? BigInt(l.blockNumber) : null,
|
|
13
|
+
contractAddress: l.contractAddress ? l.contractAddress : null,
|
|
14
|
+
cumulativeGasUsed: l.cumulativeGasUsed ? BigInt(l.cumulativeGasUsed) : null,
|
|
15
|
+
effectiveGasPrice: l.effectiveGasPrice ? BigInt(l.effectiveGasPrice) : null,
|
|
16
|
+
gasUsed: l.gasUsed ? BigInt(l.gasUsed) : null,
|
|
17
|
+
logs: l.logs ? l.logs.map((u) => m(u)) : null,
|
|
18
|
+
to: l.to ? l.to : null,
|
|
19
|
+
transactionIndex: l.transactionIndex ? d(l.transactionIndex) : null,
|
|
20
|
+
status: l.status ? f[l.status] : null,
|
|
21
|
+
type: l.type ? o[l.type] || l.type : null
|
|
22
|
+
};
|
|
23
|
+
return l.blobGasPrice && (s.blobGasPrice = BigInt(l.blobGasPrice)), l.blobGasUsed && (s.blobGasUsed = BigInt(l.blobGasUsed)), s;
|
|
24
|
+
}
|
|
25
|
+
const U = /* @__PURE__ */ b("transactionReceipt", r);
|
|
26
|
+
export {
|
|
27
|
+
U as defineTransactionReceipt,
|
|
28
|
+
r as formatTransactionReceipt,
|
|
29
|
+
f as receiptStatuses
|
|
30
|
+
};
|
package/dist/index22.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index32.cjs");class r extends s.BaseError{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}exports.InvalidAddressError=r;
|
package/dist/index22.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseError as r } from "./index32.js";
|
|
2
|
+
class d extends r {
|
|
3
|
+
constructor({ address: s }) {
|
|
4
|
+
super(`Address "${s}" is invalid.`, {
|
|
5
|
+
metaMessages: [
|
|
6
|
+
"- Address must be a hex value of 20 bytes (40 hex characters).",
|
|
7
|
+
"- Address must match its checksum counterpart."
|
|
8
|
+
],
|
|
9
|
+
name: "InvalidAddressError"
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
d as InvalidAddressError
|
|
15
|
+
};
|
package/dist/index23.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index33.cjs"),i=require("./index34.cjs"),o=/^0x[a-fA-F0-9]{40}$/,t=new c.LruMap(8192);function f(e,n){const{strict:s=!0}=n??{},r=`${e}.${s}`;if(t.has(r))return t.get(r);const u=o.test(e)?e.toLowerCase()===e?!0:s?i.checksumAddress(e)===e:!0:!1;return t.set(r,u),u}exports.isAddress=f;exports.isAddressCache=t;
|
package/dist/index23.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LruMap as u } from "./index33.js";
|
|
2
|
+
import { checksumAddress as c } from "./index34.js";
|
|
3
|
+
const i = /^0x[a-fA-F0-9]{40}$/, r = /* @__PURE__ */ new u(8192);
|
|
4
|
+
function h(t, s) {
|
|
5
|
+
const { strict: n = !0 } = s ?? {}, e = `${t}.${n}`;
|
|
6
|
+
if (r.has(e))
|
|
7
|
+
return r.get(e);
|
|
8
|
+
const o = i.test(t) ? t.toLowerCase() === t ? !0 : n ? c(t) === t : !0 : !1;
|
|
9
|
+
return r.set(e, o), o;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
h as isAddress,
|
|
13
|
+
r as isAddressCache
|
|
14
|
+
};
|
package/dist/index24.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(e){return`0x${e.reduce((t,c)=>t+c.replace("0x",""),"")}`}exports.concatHex=r;
|
package/dist/index24.js
ADDED
package/dist/index25.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./index28.cjs"),f=require("./index35.cjs"),x=require("./index18.cjs"),z=Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function H(e,n={}){return typeof e=="number"||typeof e=="bigint"?d(e,n):typeof e=="string"?m(e,n):typeof e=="boolean"?b(e,n):u(e,n)}function b(e,n={}){const t=`0x${Number(e)}`;return typeof n.size=="number"?(x.assertSize(t,{size:n.size}),f.pad(t,{size:n.size})):t}function u(e,n={}){let t="";for(let i=0;i<e.length;i++)t+=z[e[i]];const r=`0x${t}`;return typeof n.size=="number"?(x.assertSize(r,{size:n.size}),f.pad(r,{dir:"right",size:n.size})):r}function d(e,n={}){const{signed:t,size:r}=n,i=BigInt(e);let o;r?t?o=(1n<<BigInt(r)*8n-1n)-1n:o=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(o=BigInt(Number.MAX_SAFE_INTEGER));const c=typeof o=="bigint"&&t?-o-1n:0;if(o&&i>o||i<c){const s=typeof e=="bigint"?"n":"";throw new y.IntegerOutOfRangeError({max:o?`${o}${s}`:void 0,min:`${c}${s}`,signed:t,size:r,value:`${e}${s}`})}const g=`0x${(t&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?f.pad(g,{size:r}):g}const T=new TextEncoder;function m(e,n={}){const t=T.encode(e);return u(t,n)}exports.boolToHex=b;exports.bytesToHex=u;exports.numberToHex=d;exports.stringToHex=m;exports.toHex=H;
|
package/dist/index25.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { IntegerOutOfRangeError as x } from "./index28.js";
|
|
2
|
+
import { pad as s } from "./index35.js";
|
|
3
|
+
import { assertSize as c } from "./index18.js";
|
|
4
|
+
const b = /* @__PURE__ */ Array.from({ length: 256 }, (n, e) => e.toString(16).padStart(2, "0"));
|
|
5
|
+
function B(n, e = {}) {
|
|
6
|
+
return typeof n == "number" || typeof n == "bigint" ? y(n, e) : typeof n == "string" ? $(n, e) : typeof n == "boolean" ? z(n, e) : m(n, e);
|
|
7
|
+
}
|
|
8
|
+
function z(n, e = {}) {
|
|
9
|
+
const t = `0x${Number(n)}`;
|
|
10
|
+
return typeof e.size == "number" ? (c(t, { size: e.size }), s(t, { size: e.size })) : t;
|
|
11
|
+
}
|
|
12
|
+
function m(n, e = {}) {
|
|
13
|
+
let t = "";
|
|
14
|
+
for (let i = 0; i < n.length; i++)
|
|
15
|
+
t += b[n[i]];
|
|
16
|
+
const r = `0x${t}`;
|
|
17
|
+
return typeof e.size == "number" ? (c(r, { size: e.size }), s(r, { dir: "right", size: e.size })) : r;
|
|
18
|
+
}
|
|
19
|
+
function y(n, e = {}) {
|
|
20
|
+
const { signed: t, size: r } = e, i = BigInt(n);
|
|
21
|
+
let o;
|
|
22
|
+
r ? t ? o = (1n << BigInt(r) * 8n - 1n) - 1n : o = 2n ** (BigInt(r) * 8n) - 1n : typeof n == "number" && (o = BigInt(Number.MAX_SAFE_INTEGER));
|
|
23
|
+
const g = typeof o == "bigint" && t ? -o - 1n : 0;
|
|
24
|
+
if (o && i > o || i < g) {
|
|
25
|
+
const f = typeof n == "bigint" ? "n" : "";
|
|
26
|
+
throw new x({
|
|
27
|
+
max: o ? `${o}${f}` : void 0,
|
|
28
|
+
min: `${g}${f}`,
|
|
29
|
+
signed: t,
|
|
30
|
+
size: r,
|
|
31
|
+
value: `${n}${f}`
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const u = `0x${(t && i < 0 ? (1n << BigInt(r * 8)) + BigInt(i) : i).toString(16)}`;
|
|
35
|
+
return r ? s(u, { size: r }) : u;
|
|
36
|
+
}
|
|
37
|
+
const d = /* @__PURE__ */ new TextEncoder();
|
|
38
|
+
function $(n, e = {}) {
|
|
39
|
+
const t = d.encode(n);
|
|
40
|
+
return m(t, e);
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
z as boolToHex,
|
|
44
|
+
m as bytesToHex,
|
|
45
|
+
y as numberToHex,
|
|
46
|
+
$ as stringToHex,
|
|
47
|
+
B as toHex
|
|
48
|
+
};
|
package/dist/index26.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index32.cjs"),u=require("./index36.cjs"),f=require("./index37.cjs"),g=require("./index25.cjs");function c(n,e="hex"){const i=o(n),s=u.createCursor(new Uint8Array(i.length));return i.encode(s),e==="hex"?g.bytesToHex(s.bytes):s.bytes}function o(n){return Array.isArray(n)?p(n.map(e=>o(e))):y(n)}function p(n){const e=n.reduce((t,h)=>t+h.length,0),i=l(e);return{length:e<=55?1+e:1+i+e,encode(t){e<=55?t.pushByte(192+e):(t.pushByte(247+i),i===1?t.pushUint8(e):i===2?t.pushUint16(e):i===3?t.pushUint24(e):t.pushUint32(e));for(const{encode:h}of n)h(t)}}}function y(n){const e=typeof n=="string"?f.hexToBytes(n):n,i=l(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+i+e.length,encode(t){e.length===1&&e[0]<128?t.pushBytes(e):e.length<=55?(t.pushByte(128+e.length),t.pushBytes(e)):(t.pushByte(183+i),i===1?t.pushUint8(e.length):i===2?t.pushUint16(e.length):i===3?t.pushUint24(e.length):t.pushUint32(e.length),t.pushBytes(e))}}}function l(n){if(n<2**8)return 1;if(n<2**16)return 2;if(n<2**24)return 3;if(n<2**32)return 4;throw new r.BaseError("Length is too large.")}exports.toRlp=c;
|
package/dist/index26.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { BaseError as l } from "./index32.js";
|
|
2
|
+
import { createCursor as r } from "./index36.js";
|
|
3
|
+
import { hexToBytes as g } from "./index37.js";
|
|
4
|
+
import { bytesToHex as u } from "./index25.js";
|
|
5
|
+
function m(n, e = "hex") {
|
|
6
|
+
const i = s(n), h = r(new Uint8Array(i.length));
|
|
7
|
+
return i.encode(h), e === "hex" ? u(h.bytes) : h.bytes;
|
|
8
|
+
}
|
|
9
|
+
function s(n) {
|
|
10
|
+
return Array.isArray(n) ? p(n.map((e) => s(e))) : y(n);
|
|
11
|
+
}
|
|
12
|
+
function p(n) {
|
|
13
|
+
const e = n.reduce((t, f) => t + f.length, 0), i = o(e);
|
|
14
|
+
return {
|
|
15
|
+
length: e <= 55 ? 1 + e : 1 + i + e,
|
|
16
|
+
encode(t) {
|
|
17
|
+
e <= 55 ? t.pushByte(192 + e) : (t.pushByte(247 + i), i === 1 ? t.pushUint8(e) : i === 2 ? t.pushUint16(e) : i === 3 ? t.pushUint24(e) : t.pushUint32(e));
|
|
18
|
+
for (const { encode: f } of n)
|
|
19
|
+
f(t);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function y(n) {
|
|
24
|
+
const e = typeof n == "string" ? g(n) : n, i = o(e.length);
|
|
25
|
+
return {
|
|
26
|
+
length: e.length === 1 && e[0] < 128 ? 1 : e.length <= 55 ? 1 + e.length : 1 + i + e.length,
|
|
27
|
+
encode(t) {
|
|
28
|
+
e.length === 1 && e[0] < 128 ? t.pushBytes(e) : e.length <= 55 ? (t.pushByte(128 + e.length), t.pushBytes(e)) : (t.pushByte(183 + i), i === 1 ? t.pushUint8(e.length) : i === 2 ? t.pushUint16(e.length) : i === 3 ? t.pushUint24(e.length) : t.pushUint32(e.length), t.pushBytes(e));
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function o(n) {
|
|
33
|
+
if (n < 2 ** 8)
|
|
34
|
+
return 1;
|
|
35
|
+
if (n < 2 ** 16)
|
|
36
|
+
return 2;
|
|
37
|
+
if (n < 2 ** 24)
|
|
38
|
+
return 3;
|
|
39
|
+
if (n < 2 ** 32)
|
|
40
|
+
return 4;
|
|
41
|
+
throw new l("Length is too large.");
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
m as toRlp
|
|
45
|
+
};
|
package/dist/index27.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("./index38.cjs"),G=require("./index39.cjs"),R=require("./index40.cjs"),S=require("./index41.cjs"),B=require("./index42.cjs"),L=require("./index24.cjs"),h=require("./index43.cjs"),t=require("./index25.cjs"),b=require("./index26.cjs"),V=require("./index44.cjs"),z=require("./index45.cjs"),C=require("./index46.cjs"),v=require("./index47.cjs");function k(e,o){const s=C.getTransactionType(e);return s==="eip1559"?_(e,o):s==="eip2930"?j(e,o):s==="eip4844"?Y(e,o):s==="eip7702"?w(e,o):M(e,o)}function w(e,o){const{authorizationList:s,chainId:i,gas:r,nonce:c,to:a,value:x,maxFeePerGas:l,maxPriorityFeePerGas:n,accessList:H,data:d}=e;z.assertTransactionEIP7702(e);const f=v.serializeAccessList(H),u=V.serializeAuthorizationList(s);return L.concatHex(["0x04",b.toRlp([t.toHex(i),c?t.toHex(c):"0x",n?t.toHex(n):"0x",l?t.toHex(l):"0x",r?t.toHex(r):"0x",a??"0x",x?t.toHex(x):"0x",d??"0x",f,u,...T(e,o)])])}function Y(e,o){const{chainId:s,gas:i,nonce:r,to:c,value:a,maxFeePerBlobGas:x,maxFeePerGas:l,maxPriorityFeePerGas:n,accessList:H,data:d}=e;z.assertTransactionEIP4844(e);let f=e.blobVersionedHashes,u=e.sidecars;if(e.blobs&&(typeof f>"u"||typeof u>"u")){const m=typeof e.blobs[0]=="string"?e.blobs:e.blobs.map(y=>t.bytesToHex(y)),P=e.kzg,p=G.blobsToCommitments({blobs:m,kzg:P});if(typeof f>"u"&&(f=S.commitmentsToVersionedHashes({commitments:p})),typeof u>"u"){const y=R.blobsToProofs({blobs:m,commitments:p,kzg:P});u=B.toBlobSidecars({blobs:m,commitments:p,proofs:y})}}const I=v.serializeAccessList(H),A=[t.toHex(s),r?t.toHex(r):"0x",n?t.toHex(n):"0x",l?t.toHex(l):"0x",i?t.toHex(i):"0x",c??"0x",a?t.toHex(a):"0x",d??"0x",I,x?t.toHex(x):"0x",f??[],...T(e,o)],q=[],g=[],E=[];if(u)for(let m=0;m<u.length;m++){const{blob:P,commitment:p,proof:y}=u[m];q.push(P),g.push(p),E.push(y)}return L.concatHex(["0x03",u?b.toRlp([A,q,g,E]):b.toRlp(A)])}function _(e,o){const{chainId:s,gas:i,nonce:r,to:c,value:a,maxFeePerGas:x,maxPriorityFeePerGas:l,accessList:n,data:H}=e;z.assertTransactionEIP1559(e);const d=v.serializeAccessList(n),f=[t.toHex(s),r?t.toHex(r):"0x",l?t.toHex(l):"0x",x?t.toHex(x):"0x",i?t.toHex(i):"0x",c??"0x",a?t.toHex(a):"0x",H??"0x",d,...T(e,o)];return L.concatHex(["0x02",b.toRlp(f)])}function j(e,o){const{chainId:s,gas:i,data:r,nonce:c,to:a,value:x,accessList:l,gasPrice:n}=e;z.assertTransactionEIP2930(e);const H=v.serializeAccessList(l),d=[t.toHex(s),c?t.toHex(c):"0x",n?t.toHex(n):"0x",i?t.toHex(i):"0x",a??"0x",x?t.toHex(x):"0x",r??"0x",H,...T(e,o)];return L.concatHex(["0x01",b.toRlp(d)])}function M(e,o){const{chainId:s=0,gas:i,data:r,nonce:c,to:a,value:x,gasPrice:l}=e;z.assertTransactionLegacy(e);let n=[c?t.toHex(c):"0x",l?t.toHex(l):"0x",i?t.toHex(i):"0x",a??"0x",x?t.toHex(x):"0x",r??"0x"];if(o){const H=(()=>{if(o.v>=35n)return(o.v-35n)/2n>0?o.v:27n+(o.v===35n?0n:1n);if(s>0)return BigInt(s*2)+BigInt(35n+o.v-27n);const u=27n+(o.v===27n?0n:1n);if(o.v!==u)throw new F.InvalidLegacyVError({v:o.v});return u})(),d=h.trim(o.r),f=h.trim(o.s);n=[...n,t.toHex(H),d==="0x00"?"0x":d,f==="0x00"?"0x":f]}else s>0&&(n=[...n,t.toHex(s),"0x","0x"]);return b.toRlp(n)}function T(e,o){const s=o??e,{v:i,yParity:r}=s;if(typeof s.r>"u")return[];if(typeof s.s>"u")return[];if(typeof i>"u"&&typeof r>"u")return[];const c=h.trim(s.r),a=h.trim(s.s);return[typeof r=="number"?r?t.toHex(1):"0x":i===0n?"0x":i===1n?t.toHex(1):i===27n?"0x":t.toHex(1),c==="0x00"?"0x":c,a==="0x00"?"0x":a]}exports.serializeTransaction=k;exports.toYParitySignatureArray=T;
|