@coinbase/cdp-core 0.0.17 → 0.0.18
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/esm/index17.js +39 -158
- package/dist/esm/index18.js +16 -47
- package/dist/esm/index19.js +4 -152
- package/dist/esm/index20.js +5 -56
- package/dist/esm/index21.js +158 -39
- package/dist/esm/index22.js +47 -16
- package/dist/esm/index23.js +152 -4
- package/dist/esm/index24.js +56 -5
- package/dist/esm/index3.js +4 -4
- package/dist/esm/index6.js +4 -4
- package/dist/esm/index77.js +1 -1
- package/dist/esm/index80.js +79 -10
- package/dist/esm/index81.js +6 -6
- package/dist/esm/index86.js +10 -79
- package/dist/esm/index88.js +20 -12
- package/dist/esm/index89.js +9 -35
- package/dist/esm/index90.js +19 -41
- package/dist/esm/index91.js +93 -20
- package/dist/esm/index92.js +20 -9
- package/dist/esm/index93.js +114 -16
- package/dist/esm/index94.js +11 -92
- package/dist/esm/index95.js +35 -20
- package/dist/esm/index96.js +41 -117
- package/package.json +2 -2
package/dist/esm/index22.js
CHANGED
|
@@ -1,19 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
[
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
class n {
|
|
2
|
+
events = {};
|
|
3
|
+
/**
|
|
4
|
+
* Add an event listener.
|
|
5
|
+
*
|
|
6
|
+
* @param event - The name of the event to listen for.
|
|
7
|
+
* @param listener - The function to call when the event is emitted.
|
|
8
|
+
*/
|
|
9
|
+
on(e, s) {
|
|
10
|
+
this.events[e] || (this.events[e] = []), this.events[e].push(s);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Remove an event listener.
|
|
14
|
+
*
|
|
15
|
+
* @param event - The name of the event to remove the listener from.
|
|
16
|
+
* @param listener - The function to remove from the event listeners.
|
|
17
|
+
*/
|
|
18
|
+
removeListener(e, s) {
|
|
19
|
+
if (!this.events[e])
|
|
20
|
+
return;
|
|
21
|
+
const t = this.events[e].indexOf(s);
|
|
22
|
+
t > -1 && this.events[e].splice(t, 1);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Emit an event.
|
|
26
|
+
*
|
|
27
|
+
* @param event - The name of the event to emit.
|
|
28
|
+
* @param args - The arguments to pass to the event listeners.
|
|
29
|
+
*/
|
|
30
|
+
emit(e, ...s) {
|
|
31
|
+
this.events[e] && this.events[e].forEach((t) => {
|
|
32
|
+
try {
|
|
33
|
+
t(...s);
|
|
34
|
+
} catch (i) {
|
|
35
|
+
console.error(`Error in event listener for ${e}:`, i);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Remove all listeners for an event.
|
|
41
|
+
*
|
|
42
|
+
* @param event - The name of the event to remove all listeners from. If not provided, removes all listeners for all events.
|
|
43
|
+
*/
|
|
44
|
+
removeAllListeners(e) {
|
|
45
|
+
e ? delete this.events[e] : this.events = {};
|
|
46
|
+
}
|
|
16
47
|
}
|
|
17
48
|
export {
|
|
18
|
-
n as
|
|
49
|
+
n as EventEmitter
|
|
19
50
|
};
|
package/dist/esm/index23.js
CHANGED
|
@@ -1,7 +1,155 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Hex as y } from "ox";
|
|
2
|
+
import { createWalletClient as I } from "viem";
|
|
3
|
+
import { signEvmTypedData as E, signEvmHash as S, getCurrentUser as f, signOut as P, sendEvmTransaction as R, signEvmTransaction as T, signEvmMessage as A } from "./index2.js";
|
|
4
|
+
import "@coinbase/cdp-api-client";
|
|
5
|
+
import "./index3.js";
|
|
6
|
+
import { validateUserOwnsAddress as m, EIP1193ProviderError as l, STANDARD_ERROR_CODES as s, RPCRequestError as o, validateUserHasEvmAccount as x, validateUserConnected as C } from "./index4.js";
|
|
7
|
+
import "zustand";
|
|
8
|
+
import { isChainIdSupportedForCDPSends as D, chainIdToNameMapping as b } from "./index13.js";
|
|
9
|
+
function g(e) {
|
|
10
|
+
return {
|
|
11
|
+
to: e.to,
|
|
12
|
+
data: e.data,
|
|
13
|
+
value: e.value ? BigInt(e.value) : void 0,
|
|
14
|
+
nonce: e.nonce ? Number(e.nonce) : void 0,
|
|
15
|
+
gas: e.gas ? BigInt(e.gas) : void 0,
|
|
16
|
+
maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0,
|
|
17
|
+
maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0,
|
|
18
|
+
type: "eip1559"
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
async function M() {
|
|
22
|
+
return (await f())?.evmAccounts || [];
|
|
23
|
+
}
|
|
24
|
+
async function _(e, n) {
|
|
25
|
+
const a = await C();
|
|
26
|
+
return e.emit("connect", {
|
|
27
|
+
chainId: y.fromNumber(n.getState().chainId)
|
|
28
|
+
}), a.evmAccounts || [];
|
|
29
|
+
}
|
|
30
|
+
async function k(e) {
|
|
31
|
+
const [n, a] = e;
|
|
32
|
+
await m(a);
|
|
33
|
+
const t = Buffer.from(n.slice(2), "hex").toString();
|
|
34
|
+
try {
|
|
35
|
+
return (await A({
|
|
36
|
+
evmAccount: a,
|
|
37
|
+
message: t
|
|
38
|
+
})).signature;
|
|
39
|
+
} catch (c) {
|
|
40
|
+
throw new l(
|
|
41
|
+
s.provider.userRejectedRequest,
|
|
42
|
+
c instanceof Error ? c.message : "Signing failed"
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function z(e) {
|
|
47
|
+
const [n, a] = e;
|
|
48
|
+
await m(n);
|
|
49
|
+
try {
|
|
50
|
+
return (await E({
|
|
51
|
+
evmAccount: n,
|
|
52
|
+
typedData: JSON.parse(a)
|
|
53
|
+
})).signature;
|
|
54
|
+
} catch (t) {
|
|
55
|
+
throw new l(
|
|
56
|
+
s.provider.userRejectedRequest,
|
|
57
|
+
t instanceof Error ? t.message : "Signing failed"
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async function J(e, n, a) {
|
|
62
|
+
const [t] = e;
|
|
63
|
+
if (!t || typeof t != "object")
|
|
64
|
+
throw new o(
|
|
65
|
+
s.rpc.invalidParams,
|
|
66
|
+
"Transaction parameter must be an object"
|
|
67
|
+
);
|
|
68
|
+
if (!t.to)
|
|
69
|
+
throw new o(
|
|
70
|
+
s.rpc.invalidParams,
|
|
71
|
+
"Transaction must include 'to' field"
|
|
72
|
+
);
|
|
73
|
+
const d = (await x()).evmAccounts?.[0], u = n.getState(), i = t.chainId ? Number(t.chainId) : u.chainId;
|
|
74
|
+
if (!d)
|
|
75
|
+
throw new o(
|
|
76
|
+
s.rpc.invalidParams,
|
|
77
|
+
"User does not have an EVM account"
|
|
78
|
+
);
|
|
79
|
+
if (D(i))
|
|
80
|
+
try {
|
|
81
|
+
return (await R({
|
|
82
|
+
evmAccount: d,
|
|
83
|
+
transaction: { ...g(t), chainId: i },
|
|
84
|
+
network: b[i]
|
|
85
|
+
})).transactionHash;
|
|
86
|
+
} catch (r) {
|
|
87
|
+
throw console.log("Transaction failed", r), new o(
|
|
88
|
+
s.rpc.transactionRejected,
|
|
89
|
+
r instanceof Error ? r.message : "Transaction failed"
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
else
|
|
93
|
+
try {
|
|
94
|
+
const r = I({
|
|
95
|
+
// Safe as we check before calling this handler that chainId is configured
|
|
96
|
+
chain: u.chains.find((h) => h.id === i),
|
|
97
|
+
transport: a[i],
|
|
98
|
+
account: d
|
|
99
|
+
}), p = u.chains.find((h) => h.id === i), w = await r.prepareTransactionRequest({
|
|
100
|
+
...g(t),
|
|
101
|
+
chain: p
|
|
102
|
+
}), v = await T({
|
|
103
|
+
evmAccount: d,
|
|
104
|
+
transaction: {
|
|
105
|
+
...w,
|
|
106
|
+
type: "eip1559"
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
return await r.sendRawTransaction({
|
|
110
|
+
serializedTransaction: v.signedTransaction
|
|
111
|
+
});
|
|
112
|
+
} catch (r) {
|
|
113
|
+
throw new o(
|
|
114
|
+
s.rpc.transactionRejected,
|
|
115
|
+
r instanceof Error ? r.message : "Transaction failed"
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async function V(e) {
|
|
120
|
+
const [n, a] = e;
|
|
121
|
+
await m(a);
|
|
122
|
+
try {
|
|
123
|
+
return (await S({
|
|
124
|
+
evmAccount: a,
|
|
125
|
+
hash: n
|
|
126
|
+
})).signature;
|
|
127
|
+
} catch (t) {
|
|
128
|
+
throw new l(
|
|
129
|
+
s.provider.userRejectedRequest,
|
|
130
|
+
t instanceof Error ? t.message : "Signing failed"
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async function W(e) {
|
|
135
|
+
return `0x${e.getState().chainId.toString(16)}`;
|
|
136
|
+
}
|
|
137
|
+
async function $() {
|
|
138
|
+
await f() && await P();
|
|
139
|
+
}
|
|
140
|
+
function K(e, n) {
|
|
141
|
+
const a = Number.parseInt(e[0].chainId, 16);
|
|
142
|
+
n.getState().setChainId(a);
|
|
4
143
|
}
|
|
5
144
|
export {
|
|
6
|
-
|
|
145
|
+
M as handleAccounts,
|
|
146
|
+
W as handleChainId,
|
|
147
|
+
$ as handleDisconnect,
|
|
148
|
+
V as handleEthSign,
|
|
149
|
+
k as handlePersonalSign,
|
|
150
|
+
_ as handleRequestAccounts,
|
|
151
|
+
J as handleSendTransaction,
|
|
152
|
+
z as handleSignTypedData,
|
|
153
|
+
K as handleSwitchEthereumChain,
|
|
154
|
+
g as shimProviderTxRequest
|
|
7
155
|
};
|
package/dist/esm/index24.js
CHANGED
|
@@ -1,7 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { chainConfig as a } from "./index86.js";
|
|
2
|
+
import { defineChain as t } from "./index25.js";
|
|
3
|
+
const e = 11155111, r = /* @__PURE__ */ t({
|
|
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
|
+
({
|
|
54
|
+
...r
|
|
55
|
+
});
|
|
5
56
|
export {
|
|
6
|
-
|
|
57
|
+
r as baseSepolia
|
|
7
58
|
};
|
package/dist/esm/index3.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Provider as h } from "ox";
|
|
2
2
|
import { http as p } from "viem";
|
|
3
3
|
import { create as l } from "zustand";
|
|
4
|
-
import { subscribeWithSelector as f, persist as g } from "./
|
|
4
|
+
import { subscribeWithSelector as f, persist as g } from "./index21.js";
|
|
5
5
|
import { validateRequest as w, EIP1193ProviderError as I, STANDARD_ERROR_CODES as S } from "./index4.js";
|
|
6
|
-
import { EventEmitter as b } from "./
|
|
6
|
+
import { EventEmitter as b } from "./index22.js";
|
|
7
7
|
import "@coinbase/cdp-api-client";
|
|
8
|
-
import { handleChainId as A, handleSignTypedData as C, handleEthSign as _, handleSwitchEthereumChain as v, handleDisconnect as D, handleSendTransaction as E, handlePersonalSign as P, handleRequestAccounts as R, handleAccounts as y } from "./
|
|
8
|
+
import { handleChainId as A, handleSignTypedData as C, handleEthSign as _, handleSwitchEthereumChain as v, handleDisconnect as D, handleSendTransaction as E, handlePersonalSign as P, handleRequestAccounts as R, handleAccounts as y } from "./index23.js";
|
|
9
9
|
import { onAuthStateChange as T } from "./index2.js";
|
|
10
|
-
import { baseSepolia as d } from "./
|
|
10
|
+
import { baseSepolia as d } from "./index24.js";
|
|
11
11
|
function q(r, e, a) {
|
|
12
12
|
e.subscribe(
|
|
13
13
|
(t) => t.chainId,
|
package/dist/esm/index6.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { logOutEndUser as h, refreshAccessToken as l, registerTemporaryWalletSecret as c } from "@coinbase/cdp-api-client";
|
|
2
|
-
import { SignJWT as o } from "./
|
|
2
|
+
import { SignJWT as o } from "./index17.js";
|
|
3
3
|
import "viem";
|
|
4
4
|
import { toAuthState as u } from "./index7.js";
|
|
5
|
-
import { createKeyPair as S } from "./
|
|
6
|
-
import { generateRandomId as i } from "./
|
|
7
|
-
import { hash as w } from "./
|
|
5
|
+
import { createKeyPair as S } from "./index18.js";
|
|
6
|
+
import { generateRandomId as i } from "./index19.js";
|
|
7
|
+
import { hash as w } from "./index20.js";
|
|
8
8
|
import { sortKeys as f } from "./index13.js";
|
|
9
9
|
const n = 60 * 1e3;
|
|
10
10
|
class C {
|
package/dist/esm/index77.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HashMD as D, SHA256_IV as b, Chi as g, Maj as p } from "./
|
|
1
|
+
import { HashMD as D, SHA256_IV as b, Chi as g, Maj as p } from "./index80.js";
|
|
2
2
|
import { createHasher as u, clean as C, rotr as i } from "./index76.js";
|
|
3
3
|
const B = /* @__PURE__ */ Uint32Array.from([
|
|
4
4
|
1116352408,
|
package/dist/esm/index80.js
CHANGED
|
@@ -1,12 +1,81 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { Hash as g, createView as l, aexists as b, toBytes as a, abytes as d, aoutput as x, clean as w } from "./index76.js";
|
|
2
|
+
function y(o, t, s, n) {
|
|
3
|
+
if (typeof o.setBigUint64 == "function")
|
|
4
|
+
return o.setBigUint64(t, s, n);
|
|
5
|
+
const i = BigInt(32), h = BigInt(4294967295), e = Number(s >> i & h), r = Number(s & h), c = n ? 4 : 0, u = n ? 0 : 4;
|
|
6
|
+
o.setUint32(t + c, e, n), o.setUint32(t + u, r, n);
|
|
7
|
+
}
|
|
8
|
+
function U(o, t, s) {
|
|
9
|
+
return o & t ^ ~o & s;
|
|
10
|
+
}
|
|
11
|
+
function _(o, t, s) {
|
|
12
|
+
return o & t ^ o & s ^ t & s;
|
|
13
|
+
}
|
|
14
|
+
class m extends g {
|
|
15
|
+
constructor(t, s, n, i) {
|
|
16
|
+
super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = t, this.outputLen = s, this.padOffset = n, this.isLE = i, this.buffer = new Uint8Array(t), this.view = l(this.buffer);
|
|
17
|
+
}
|
|
18
|
+
update(t) {
|
|
19
|
+
b(this), t = a(t), d(t);
|
|
20
|
+
const { view: s, buffer: n, blockLen: i } = this, h = t.length;
|
|
21
|
+
for (let e = 0; e < h; ) {
|
|
22
|
+
const r = Math.min(i - this.pos, h - e);
|
|
23
|
+
if (r === i) {
|
|
24
|
+
const c = l(t);
|
|
25
|
+
for (; i <= h - e; e += i)
|
|
26
|
+
this.process(c, e);
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
n.set(t.subarray(e, e + r), this.pos), this.pos += r, e += r, this.pos === i && (this.process(s, 0), this.pos = 0);
|
|
30
|
+
}
|
|
31
|
+
return this.length += t.length, this.roundClean(), this;
|
|
32
|
+
}
|
|
33
|
+
digestInto(t) {
|
|
34
|
+
b(this), x(t, this), this.finished = !0;
|
|
35
|
+
const { buffer: s, view: n, blockLen: i, isLE: h } = this;
|
|
36
|
+
let { pos: e } = this;
|
|
37
|
+
s[e++] = 128, w(this.buffer.subarray(e)), this.padOffset > i - e && (this.process(n, 0), e = 0);
|
|
38
|
+
for (let f = e; f < i; f++)
|
|
39
|
+
s[f] = 0;
|
|
40
|
+
y(n, i - 8, BigInt(this.length * 8), h), this.process(n, 0);
|
|
41
|
+
const r = l(t), c = this.outputLen;
|
|
42
|
+
if (c % 4)
|
|
43
|
+
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
44
|
+
const u = c / 4, p = this.get();
|
|
45
|
+
if (u > p.length)
|
|
46
|
+
throw new Error("_sha2: outputLen bigger than state");
|
|
47
|
+
for (let f = 0; f < u; f++)
|
|
48
|
+
r.setUint32(4 * f, p[f], h);
|
|
49
|
+
}
|
|
50
|
+
digest() {
|
|
51
|
+
const { buffer: t, outputLen: s } = this;
|
|
52
|
+
this.digestInto(t);
|
|
53
|
+
const n = t.slice(0, s);
|
|
54
|
+
return this.destroy(), n;
|
|
55
|
+
}
|
|
56
|
+
_cloneInto(t) {
|
|
57
|
+
t || (t = new this.constructor()), t.set(...this.get());
|
|
58
|
+
const { blockLen: s, buffer: n, length: i, finished: h, destroyed: e, pos: r } = this;
|
|
59
|
+
return t.destroyed = e, t.finished = h, t.length = i, t.pos = r, i % s && t.buffer.set(n), t;
|
|
60
|
+
}
|
|
61
|
+
clone() {
|
|
62
|
+
return this._cloneInto();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const B = /* @__PURE__ */ Uint32Array.from([
|
|
66
|
+
1779033703,
|
|
67
|
+
3144134277,
|
|
68
|
+
1013904242,
|
|
69
|
+
2773480762,
|
|
70
|
+
1359893119,
|
|
71
|
+
2600822924,
|
|
72
|
+
528734635,
|
|
73
|
+
1541459225
|
|
74
|
+
]);
|
|
10
75
|
export {
|
|
11
|
-
|
|
76
|
+
U as Chi,
|
|
77
|
+
m as HashMD,
|
|
78
|
+
_ as Maj,
|
|
79
|
+
B as SHA256_IV,
|
|
80
|
+
y as setBigUint64
|
|
12
81
|
};
|
package/dist/esm/index81.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { encode as d } from "./
|
|
2
|
-
import y from "./
|
|
3
|
-
import b from "./
|
|
1
|
+
import { encode as d } from "./index88.js";
|
|
2
|
+
import y from "./index89.js";
|
|
3
|
+
import b from "./index90.js";
|
|
4
4
|
import { JWSInvalid as r } from "./index71.js";
|
|
5
5
|
import { encoder as s, concat as u, decoder as h } from "./index82.js";
|
|
6
|
-
import g from "./
|
|
7
|
-
import H from "./
|
|
8
|
-
import P from "./
|
|
6
|
+
import g from "./index91.js";
|
|
7
|
+
import H from "./index92.js";
|
|
8
|
+
import P from "./index93.js";
|
|
9
9
|
class x {
|
|
10
10
|
#r;
|
|
11
11
|
#e;
|
package/dist/esm/index86.js
CHANGED
|
@@ -1,81 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
function _(o, t, s) {
|
|
12
|
-
return o & t ^ o & s ^ t & s;
|
|
13
|
-
}
|
|
14
|
-
class m extends g {
|
|
15
|
-
constructor(t, s, n, i) {
|
|
16
|
-
super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = t, this.outputLen = s, this.padOffset = n, this.isLE = i, this.buffer = new Uint8Array(t), this.view = l(this.buffer);
|
|
17
|
-
}
|
|
18
|
-
update(t) {
|
|
19
|
-
b(this), t = a(t), d(t);
|
|
20
|
-
const { view: s, buffer: n, blockLen: i } = this, h = t.length;
|
|
21
|
-
for (let e = 0; e < h; ) {
|
|
22
|
-
const r = Math.min(i - this.pos, h - e);
|
|
23
|
-
if (r === i) {
|
|
24
|
-
const c = l(t);
|
|
25
|
-
for (; i <= h - e; e += i)
|
|
26
|
-
this.process(c, e);
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
n.set(t.subarray(e, e + r), this.pos), this.pos += r, e += r, this.pos === i && (this.process(s, 0), this.pos = 0);
|
|
30
|
-
}
|
|
31
|
-
return this.length += t.length, this.roundClean(), this;
|
|
32
|
-
}
|
|
33
|
-
digestInto(t) {
|
|
34
|
-
b(this), x(t, this), this.finished = !0;
|
|
35
|
-
const { buffer: s, view: n, blockLen: i, isLE: h } = this;
|
|
36
|
-
let { pos: e } = this;
|
|
37
|
-
s[e++] = 128, w(this.buffer.subarray(e)), this.padOffset > i - e && (this.process(n, 0), e = 0);
|
|
38
|
-
for (let f = e; f < i; f++)
|
|
39
|
-
s[f] = 0;
|
|
40
|
-
y(n, i - 8, BigInt(this.length * 8), h), this.process(n, 0);
|
|
41
|
-
const r = l(t), c = this.outputLen;
|
|
42
|
-
if (c % 4)
|
|
43
|
-
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
44
|
-
const u = c / 4, p = this.get();
|
|
45
|
-
if (u > p.length)
|
|
46
|
-
throw new Error("_sha2: outputLen bigger than state");
|
|
47
|
-
for (let f = 0; f < u; f++)
|
|
48
|
-
r.setUint32(4 * f, p[f], h);
|
|
49
|
-
}
|
|
50
|
-
digest() {
|
|
51
|
-
const { buffer: t, outputLen: s } = this;
|
|
52
|
-
this.digestInto(t);
|
|
53
|
-
const n = t.slice(0, s);
|
|
54
|
-
return this.destroy(), n;
|
|
55
|
-
}
|
|
56
|
-
_cloneInto(t) {
|
|
57
|
-
t || (t = new this.constructor()), t.set(...this.get());
|
|
58
|
-
const { blockLen: s, buffer: n, length: i, finished: h, destroyed: e, pos: r } = this;
|
|
59
|
-
return t.destroyed = e, t.finished = h, t.length = i, t.pos = r, i % s && t.buffer.set(n), t;
|
|
60
|
-
}
|
|
61
|
-
clone() {
|
|
62
|
-
return this._cloneInto();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
const B = /* @__PURE__ */ Uint32Array.from([
|
|
66
|
-
1779033703,
|
|
67
|
-
3144134277,
|
|
68
|
-
1013904242,
|
|
69
|
-
2773480762,
|
|
70
|
-
1359893119,
|
|
71
|
-
2600822924,
|
|
72
|
-
528734635,
|
|
73
|
-
1541459225
|
|
74
|
-
]);
|
|
1
|
+
import { contracts as o } from "./index94.js";
|
|
2
|
+
import { formatters as r } from "./index95.js";
|
|
3
|
+
import { serializers as t } from "./index96.js";
|
|
4
|
+
const e = {
|
|
5
|
+
blockTime: 2e3,
|
|
6
|
+
contracts: o,
|
|
7
|
+
formatters: r,
|
|
8
|
+
serializers: t
|
|
9
|
+
};
|
|
75
10
|
export {
|
|
76
|
-
|
|
77
|
-
m as HashMD,
|
|
78
|
-
_ as Maj,
|
|
79
|
-
B as SHA256_IV,
|
|
80
|
-
y as setBigUint64
|
|
11
|
+
e as chainConfig
|
|
81
12
|
};
|
package/dist/esm/index88.js
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { encoder as t, decoder as o } from "./index82.js";
|
|
2
|
+
import { encodeBase64 as c, decodeBase64 as a } from "./index97.js";
|
|
3
|
+
function i(r) {
|
|
4
|
+
if (Uint8Array.fromBase64)
|
|
5
|
+
return Uint8Array.fromBase64(typeof r == "string" ? r : o.decode(r), {
|
|
6
|
+
alphabet: "base64url"
|
|
7
|
+
});
|
|
8
|
+
let e = r;
|
|
9
|
+
e instanceof Uint8Array && (e = o.decode(e)), e = e.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
10
|
+
try {
|
|
11
|
+
return a(e);
|
|
12
|
+
} catch {
|
|
13
|
+
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
11
14
|
}
|
|
12
|
-
}
|
|
15
|
+
}
|
|
16
|
+
function p(r) {
|
|
17
|
+
let e = r;
|
|
18
|
+
return typeof e == "string" && (e = t.encode(e)), Uint8Array.prototype.toBase64 ? e.toBase64({ alphabet: "base64url", omitPadding: !0 }) : c(e).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
19
|
+
}
|
|
13
20
|
export {
|
|
14
|
-
|
|
21
|
+
i as decode,
|
|
22
|
+
p as encode
|
|
15
23
|
};
|
package/dist/esm/index89.js
CHANGED
|
@@ -1,38 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
transactions: e.transactions?.map((t) => {
|
|
10
|
-
if (typeof t == "string")
|
|
11
|
-
return t;
|
|
12
|
-
const i = m(t);
|
|
13
|
-
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;
|
|
14
|
-
}),
|
|
15
|
-
stateRoot: e.stateRoot
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
}),
|
|
19
|
-
transaction: /* @__PURE__ */ s({
|
|
20
|
-
format(e) {
|
|
21
|
-
const o = {};
|
|
22
|
-
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;
|
|
23
|
-
}
|
|
24
|
-
}),
|
|
25
|
-
transactionReceipt: /* @__PURE__ */ l({
|
|
26
|
-
format(e) {
|
|
27
|
-
return {
|
|
28
|
-
l1GasPrice: e.l1GasPrice ? n(e.l1GasPrice) : null,
|
|
29
|
-
l1GasUsed: e.l1GasUsed ? n(e.l1GasUsed) : null,
|
|
30
|
-
l1Fee: e.l1Fee ? n(e.l1Fee) : null,
|
|
31
|
-
l1FeeScalar: e.l1FeeScalar ? Number(e.l1FeeScalar) : null
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
})
|
|
1
|
+
import n from "./index98.js";
|
|
2
|
+
import s from "./index99.js";
|
|
3
|
+
import a from "./index100.js";
|
|
4
|
+
const y = async (t, o, e) => {
|
|
5
|
+
const r = await a(t, o, "sign");
|
|
6
|
+
s(t, r);
|
|
7
|
+
const i = await crypto.subtle.sign(n(t, r.algorithm), r, e);
|
|
8
|
+
return new Uint8Array(i);
|
|
35
9
|
};
|
|
36
10
|
export {
|
|
37
|
-
|
|
11
|
+
y as default
|
|
38
12
|
};
|