@coinbase/cdp-core 0.0.47 → 0.0.49
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/index.native12.js +4 -4
- package/dist/esm/index.native17.js +1 -1
- package/dist/esm/index.native18.js +33 -24
- package/dist/esm/index.native2.js +8 -6
- package/dist/esm/index.native22.js +1 -1
- package/dist/esm/index.native3.js +2 -2
- package/dist/esm/index.native32.js +940 -149
- package/dist/esm/index.native33.js +2 -48
- package/dist/esm/index.native34.js +43 -244
- package/dist/esm/index.native35.js +27 -55
- package/dist/esm/index.native36.js +149 -940
- package/dist/esm/index.native37.js +48 -2
- package/dist/esm/index.native38.js +244 -43
- package/dist/esm/index.native39.js +55 -27
- package/dist/esm/index.native4.js +4 -2
- package/dist/esm/index.native5.js +19 -17
- package/dist/esm/index.native6.js +10 -8
- package/dist/esm/index.web100.js +2 -7
- package/dist/esm/index.web101.js +17 -17
- package/dist/esm/index.web102.js +20 -10
- package/dist/esm/index.web103.js +80 -20
- package/dist/esm/index.web104.js +99 -89
- package/dist/esm/index.web105.js +32 -20
- package/dist/esm/index.web106.js +7 -118
- package/dist/esm/index.web107.js +10 -79
- package/dist/esm/index.web108.js +79 -10
- package/dist/esm/index.web109.js +18 -5
- package/dist/esm/index.web110.js +28 -18
- package/dist/esm/index.web111.js +6 -26
- package/dist/esm/index.web112.js +9 -6
- package/dist/esm/index.web113.js +13 -11
- package/dist/esm/index.web114.js +8 -11
- package/dist/esm/index.web115.js +14 -7
- package/dist/esm/index.web116.js +80 -16
- package/dist/esm/index.web117.js +5 -81
- package/dist/esm/index.web119.js +4 -4
- package/dist/esm/index.web120.js +5 -5
- package/dist/esm/index.web16.js +1 -1
- package/dist/esm/index.web17.js +33 -24
- package/dist/esm/index.web2.js +10 -8
- package/dist/esm/index.web21.js +1 -1
- package/dist/esm/index.web25.js +13 -13
- package/dist/esm/index.web27.js +3 -3
- package/dist/esm/index.web3.js +4 -2
- package/dist/esm/index.web30.js +2 -2
- package/dist/esm/index.web34.js +2 -2
- package/dist/esm/index.web35.js +16 -950
- package/dist/esm/index.web36.js +23 -2
- package/dist/esm/index.web37.js +50 -49
- package/dist/esm/index.web38.js +950 -27
- package/dist/esm/index.web39.js +2 -17
- package/dist/esm/index.web4.js +12 -12
- package/dist/esm/index.web40.js +48 -21
- package/dist/esm/index.web41.js +27 -50
- package/dist/esm/index.web44.js +54 -8
- package/dist/esm/index.web45.js +9 -16
- package/dist/esm/index.web46.js +2 -46
- package/dist/esm/index.web47.js +45 -14
- package/dist/esm/index.web48.js +12 -54
- package/dist/esm/index.web49.js +8 -6
- package/dist/esm/index.web5.js +4 -2
- package/dist/esm/index.web50.js +16 -20
- package/dist/esm/index.web51.js +45 -11
- package/dist/esm/index.web52.js +13 -3
- package/dist/esm/index.web53.js +55 -3
- package/dist/esm/index.web54.js +6 -34
- package/dist/esm/index.web55.js +19 -10
- package/dist/esm/index.web56.js +11 -4
- package/dist/esm/index.web57.js +3 -28
- package/dist/esm/index.web58.js +3 -6
- package/dist/esm/index.web59.js +34 -24
- package/dist/esm/index.web60.js +12 -16
- package/dist/esm/index.web61.js +4 -54
- package/dist/esm/index.web62.js +25 -20
- package/dist/esm/index.web63.js +6 -11
- package/dist/esm/index.web64.js +23 -26
- package/dist/esm/index.web65.js +16 -42
- package/dist/esm/index.web66.js +52 -53
- package/dist/esm/index.web67.js +23 -127
- package/dist/esm/index.web68.js +11 -12
- package/dist/esm/index.web69.js +27 -104
- package/dist/esm/index.web70.js +42 -6
- package/dist/esm/index.web71.js +56 -3
- package/dist/esm/index.web72.js +127 -14
- package/dist/esm/index.web73.js +9 -39
- package/dist/esm/index.web74.js +100 -74
- package/dist/esm/index.web75.js +7 -2
- package/dist/esm/index.web76.js +3 -2
- package/dist/esm/index.web77.js +14 -12
- package/dist/esm/index.web78.js +34 -29
- package/dist/esm/index.web79.js +77 -5
- package/dist/esm/index.web80.js +2 -35
- package/dist/esm/index.web81.js +2 -9
- package/dist/esm/index.web82.js +11 -9
- package/dist/esm/index.web83.js +37 -11
- package/dist/esm/index.web84.js +6 -13
- package/dist/esm/index.web85.js +33 -17
- package/dist/esm/index.web86.js +8 -5
- package/dist/esm/index.web87.js +11 -5
- package/dist/esm/index.web88.js +11 -10
- package/dist/esm/index.web89.js +13 -54
- package/dist/esm/index.web90.js +18 -10
- package/dist/esm/index.web91.js +6 -2
- package/dist/esm/index.web92.js +4 -44
- package/dist/esm/index.web93.js +10 -13
- package/dist/esm/index.web94.js +21 -2
- package/dist/esm/index.web95.js +10 -21
- package/dist/esm/index.web96.js +19 -19
- package/dist/esm/index.web97.js +94 -80
- package/dist/esm/index.web98.js +20 -103
- package/dist/esm/index.web99.js +115 -30
- package/dist/native/index.native12.js +4 -4
- package/dist/native/index.native17.js +1 -1
- package/dist/native/index.native18.js +33 -24
- package/dist/native/index.native2.js +8 -6
- package/dist/native/index.native22.js +1 -1
- package/dist/native/index.native3.js +2 -2
- package/dist/native/index.native32.js +940 -149
- package/dist/native/index.native33.js +2 -48
- package/dist/native/index.native34.js +43 -244
- package/dist/native/index.native35.js +27 -55
- package/dist/native/index.native36.js +149 -940
- package/dist/native/index.native37.js +48 -2
- package/dist/native/index.native38.js +244 -43
- package/dist/native/index.native39.js +55 -27
- package/dist/native/index.native4.js +4 -2
- package/dist/native/index.native5.js +19 -17
- package/dist/native/index.native6.js +10 -8
- package/dist/native-types/platform/types.d.ts +3 -3
- package/dist/native-types/types.d.ts +5 -7
- package/dist/types/platform/types.d.ts +3 -3
- package/dist/types/types.d.ts +5 -7
- package/dist/web/index.web100.js +2 -7
- package/dist/web/index.web101.js +17 -17
- package/dist/web/index.web102.js +20 -10
- package/dist/web/index.web103.js +80 -20
- package/dist/web/index.web104.js +99 -89
- package/dist/web/index.web105.js +32 -20
- package/dist/web/index.web106.js +7 -118
- package/dist/web/index.web107.js +10 -79
- package/dist/web/index.web108.js +79 -10
- package/dist/web/index.web109.js +18 -5
- package/dist/web/index.web110.js +28 -18
- package/dist/web/index.web111.js +6 -26
- package/dist/web/index.web112.js +9 -6
- package/dist/web/index.web113.js +13 -11
- package/dist/web/index.web114.js +8 -11
- package/dist/web/index.web115.js +14 -7
- package/dist/web/index.web116.js +80 -16
- package/dist/web/index.web117.js +5 -81
- package/dist/web/index.web119.js +4 -4
- package/dist/web/index.web120.js +5 -5
- package/dist/web/index.web16.js +1 -1
- package/dist/web/index.web17.js +33 -24
- package/dist/web/index.web2.js +10 -8
- package/dist/web/index.web21.js +1 -1
- package/dist/web/index.web25.js +13 -13
- package/dist/web/index.web27.js +3 -3
- package/dist/web/index.web3.js +4 -2
- package/dist/web/index.web30.js +2 -2
- package/dist/web/index.web34.js +2 -2
- package/dist/web/index.web35.js +16 -950
- package/dist/web/index.web36.js +23 -2
- package/dist/web/index.web37.js +50 -49
- package/dist/web/index.web38.js +950 -27
- package/dist/web/index.web39.js +2 -17
- package/dist/web/index.web4.js +12 -12
- package/dist/web/index.web40.js +48 -21
- package/dist/web/index.web41.js +27 -50
- package/dist/web/index.web44.js +54 -8
- package/dist/web/index.web45.js +9 -16
- package/dist/web/index.web46.js +2 -46
- package/dist/web/index.web47.js +45 -14
- package/dist/web/index.web48.js +12 -54
- package/dist/web/index.web49.js +8 -6
- package/dist/web/index.web5.js +4 -2
- package/dist/web/index.web50.js +16 -20
- package/dist/web/index.web51.js +45 -11
- package/dist/web/index.web52.js +13 -3
- package/dist/web/index.web53.js +55 -3
- package/dist/web/index.web54.js +6 -34
- package/dist/web/index.web55.js +19 -10
- package/dist/web/index.web56.js +11 -4
- package/dist/web/index.web57.js +3 -28
- package/dist/web/index.web58.js +3 -6
- package/dist/web/index.web59.js +34 -24
- package/dist/web/index.web60.js +12 -16
- package/dist/web/index.web61.js +4 -54
- package/dist/web/index.web62.js +25 -20
- package/dist/web/index.web63.js +6 -11
- package/dist/web/index.web64.js +23 -26
- package/dist/web/index.web65.js +16 -42
- package/dist/web/index.web66.js +52 -53
- package/dist/web/index.web67.js +23 -127
- package/dist/web/index.web68.js +11 -12
- package/dist/web/index.web69.js +27 -104
- package/dist/web/index.web70.js +42 -6
- package/dist/web/index.web71.js +56 -3
- package/dist/web/index.web72.js +127 -14
- package/dist/web/index.web73.js +9 -39
- package/dist/web/index.web74.js +100 -74
- package/dist/web/index.web75.js +7 -2
- package/dist/web/index.web76.js +3 -2
- package/dist/web/index.web77.js +14 -12
- package/dist/web/index.web78.js +34 -29
- package/dist/web/index.web79.js +77 -5
- package/dist/web/index.web80.js +2 -35
- package/dist/web/index.web81.js +2 -9
- package/dist/web/index.web82.js +11 -9
- package/dist/web/index.web83.js +37 -11
- package/dist/web/index.web84.js +6 -13
- package/dist/web/index.web85.js +33 -17
- package/dist/web/index.web86.js +8 -5
- package/dist/web/index.web87.js +11 -5
- package/dist/web/index.web88.js +11 -10
- package/dist/web/index.web89.js +13 -54
- package/dist/web/index.web90.js +18 -10
- package/dist/web/index.web91.js +6 -2
- package/dist/web/index.web92.js +4 -44
- package/dist/web/index.web93.js +10 -13
- package/dist/web/index.web94.js +21 -2
- package/dist/web/index.web95.js +10 -21
- package/dist/web/index.web96.js +19 -19
- package/dist/web/index.web97.js +94 -80
- package/dist/web/index.web98.js +20 -103
- package/dist/web/index.web99.js +115 -30
- package/dist/web-types/platform/types.d.ts +3 -3
- package/dist/web-types/types.d.ts +5 -7
- package/package.json +2 -2
|
@@ -1,4 +1,50 @@
|
|
|
1
|
-
|
|
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
|
+
}
|
|
47
|
+
}
|
|
2
48
|
export {
|
|
3
|
-
|
|
49
|
+
n as EventEmitter
|
|
4
50
|
};
|
|
@@ -1,52 +1,253 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { Hex as E } from "ox";
|
|
2
|
+
import { toHex as T, createWalletClient as P } from "viem";
|
|
3
|
+
import { getUserOperation as R, sendUserOperation as b, signEvmTypedData as U, signEvmHash as x, getCurrentUser as w, signOut as H, sendEvmTransaction as O, signEvmTransaction as D, signEvmMessage as N } from "./index.native7.js";
|
|
4
|
+
import "@coinbase/cdp-api-client";
|
|
5
|
+
import "./index.native12.js";
|
|
6
|
+
import { validateUserConnected as v, validateUserHasEvmSmartAccount as S, RPCRequestError as u, STANDARD_ERROR_CODES as o, validateIsUsingEOA as h, validateUserOwnsAddress as p, EIP1193ProviderError as g } from "./index.native13.js";
|
|
7
|
+
import "zustand";
|
|
8
|
+
import { userOperationChainIdToNameMapping as m, isChainIdSupportedForCDPUserOps as I, isChainIdSupportedForCDPSends as F, sendTransactionChainIdToNameMapping as j, userOperationNameToChainIdMapping as k } from "./index.native24.js";
|
|
9
|
+
function f(t) {
|
|
10
|
+
return {
|
|
11
|
+
to: t.to,
|
|
12
|
+
data: t.data,
|
|
13
|
+
value: t.value ? BigInt(t.value) : void 0,
|
|
14
|
+
nonce: t.nonce ? Number(t.nonce) : void 0,
|
|
15
|
+
gas: t.gas ? BigInt(t.gas) : void 0,
|
|
16
|
+
maxFeePerGas: t.maxFeePerGas ? BigInt(t.maxFeePerGas) : void 0,
|
|
17
|
+
maxPriorityFeePerGas: t.maxPriorityFeePerGas ? BigInt(t.maxPriorityFeePerGas) : void 0,
|
|
18
|
+
type: "eip1559"
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function q(t) {
|
|
22
|
+
return t.map((e) => ({
|
|
23
|
+
to: e.to,
|
|
24
|
+
data: e.data,
|
|
25
|
+
value: e.value ? BigInt(e.value) : void 0
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
function B(t) {
|
|
29
|
+
return {
|
|
30
|
+
atomic: !0,
|
|
31
|
+
chainId: k[t.network] ?? 0,
|
|
32
|
+
receipts: t.receipts?.map((e) => ({
|
|
33
|
+
transactionHash: e.transactionHash,
|
|
34
|
+
blockHash: e.blockHash,
|
|
35
|
+
blockNumber: BigInt(e.blockNumber ?? 0),
|
|
36
|
+
gasUsed: BigInt(e.gasUsed ?? 0),
|
|
37
|
+
logs: [],
|
|
38
|
+
status: ""
|
|
39
|
+
})),
|
|
40
|
+
id: t.userOpHash,
|
|
41
|
+
status: G(t.status),
|
|
42
|
+
version: "1"
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function G(t) {
|
|
46
|
+
switch (t) {
|
|
47
|
+
case "dropped":
|
|
48
|
+
case "failed":
|
|
49
|
+
return 400;
|
|
50
|
+
case "complete":
|
|
51
|
+
return 200;
|
|
52
|
+
default:
|
|
53
|
+
return 100;
|
|
21
54
|
}
|
|
22
|
-
|
|
23
|
-
|
|
55
|
+
}
|
|
56
|
+
async function Q() {
|
|
57
|
+
const t = await w();
|
|
58
|
+
return t?.evmSmartAccounts && t.evmSmartAccounts.length > 0 ? t.evmSmartAccounts : t?.evmAccounts || [];
|
|
59
|
+
}
|
|
60
|
+
async function X(t, e) {
|
|
61
|
+
const a = await v();
|
|
62
|
+
return t.emit("connect", {
|
|
63
|
+
chainId: E.fromNumber(e.getState().chainId)
|
|
64
|
+
}), a.evmSmartAccounts && a.evmSmartAccounts.length > 0 ? a.evmSmartAccounts : a.evmAccounts || [];
|
|
65
|
+
}
|
|
66
|
+
async function Y(t) {
|
|
67
|
+
await h();
|
|
68
|
+
const [e, a] = t;
|
|
69
|
+
await p(a);
|
|
70
|
+
const r = Buffer.from(e.slice(2), "hex").toString();
|
|
71
|
+
try {
|
|
72
|
+
return (await N({
|
|
73
|
+
evmAccount: a,
|
|
74
|
+
message: r
|
|
75
|
+
})).signature;
|
|
76
|
+
} catch (n) {
|
|
77
|
+
throw new g(
|
|
78
|
+
o.provider.userRejectedRequest,
|
|
79
|
+
n instanceof Error ? n.message : "Signing failed"
|
|
80
|
+
);
|
|
24
81
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
82
|
+
}
|
|
83
|
+
async function Z(t) {
|
|
84
|
+
await h();
|
|
85
|
+
const [e, a] = t;
|
|
86
|
+
await p(e);
|
|
87
|
+
try {
|
|
88
|
+
return (await U({
|
|
89
|
+
evmAccount: e,
|
|
90
|
+
typedData: JSON.parse(a)
|
|
91
|
+
})).signature;
|
|
92
|
+
} catch (r) {
|
|
93
|
+
throw new g(
|
|
94
|
+
o.provider.userRejectedRequest,
|
|
95
|
+
r instanceof Error ? r.message : "Signing failed"
|
|
96
|
+
);
|
|
30
97
|
}
|
|
31
|
-
|
|
32
|
-
|
|
98
|
+
}
|
|
99
|
+
async function tt(t, e, a) {
|
|
100
|
+
const r = await h({
|
|
101
|
+
errorMessage: "sendTransaction with a smart account is not supported. Use sendCalls instead."
|
|
102
|
+
}), [n] = t;
|
|
103
|
+
if (!n || typeof n != "object")
|
|
104
|
+
throw new u(
|
|
105
|
+
o.rpc.invalidParams,
|
|
106
|
+
"Transaction parameter must be an object"
|
|
107
|
+
);
|
|
108
|
+
if (!n.to)
|
|
109
|
+
throw new u(
|
|
110
|
+
o.rpc.invalidParams,
|
|
111
|
+
"Transaction must include 'to' field"
|
|
112
|
+
);
|
|
113
|
+
const d = r.evmAccounts?.[0], i = e.getState(), s = n.chainId ? Number(n.chainId) : i.chainId;
|
|
114
|
+
if (!d)
|
|
115
|
+
throw new u(
|
|
116
|
+
o.rpc.invalidParams,
|
|
117
|
+
"User does not have an EVM account"
|
|
118
|
+
);
|
|
119
|
+
if (F(s))
|
|
120
|
+
try {
|
|
121
|
+
return (await O({
|
|
122
|
+
evmAccount: d,
|
|
123
|
+
transaction: { ...f(n), chainId: s },
|
|
124
|
+
network: j[s]
|
|
125
|
+
})).transactionHash;
|
|
126
|
+
} catch (c) {
|
|
127
|
+
throw console.log("Transaction failed", c), new u(
|
|
128
|
+
o.rpc.transactionRejected,
|
|
129
|
+
c instanceof Error ? c.message : "Transaction failed"
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
else
|
|
133
|
+
try {
|
|
134
|
+
const c = P({
|
|
135
|
+
// Safe as we check before calling this handler that chainId is configured
|
|
136
|
+
chain: i.chains.find((l) => l.id === s),
|
|
137
|
+
transport: a[s],
|
|
138
|
+
account: d
|
|
139
|
+
}), y = i.chains.find((l) => l.id === s), A = await c.prepareTransactionRequest({
|
|
140
|
+
...f(n),
|
|
141
|
+
chain: y
|
|
142
|
+
}), C = await D({
|
|
143
|
+
evmAccount: d,
|
|
144
|
+
transaction: {
|
|
145
|
+
...A,
|
|
146
|
+
type: "eip1559"
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
return await c.sendRawTransaction({
|
|
150
|
+
serializedTransaction: C.signedTransaction
|
|
151
|
+
});
|
|
152
|
+
} catch (c) {
|
|
153
|
+
throw new u(
|
|
154
|
+
o.rpc.transactionRejected,
|
|
155
|
+
c instanceof Error ? c.message : "Transaction failed"
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
async function et(t) {
|
|
160
|
+
await h();
|
|
161
|
+
const [e, a] = t;
|
|
162
|
+
await p(a);
|
|
163
|
+
try {
|
|
164
|
+
return (await x({
|
|
165
|
+
evmAccount: a,
|
|
166
|
+
hash: e
|
|
167
|
+
})).signature;
|
|
168
|
+
} catch (r) {
|
|
169
|
+
throw new g(
|
|
170
|
+
o.provider.userRejectedRequest,
|
|
171
|
+
r instanceof Error ? r.message : "Signing failed"
|
|
172
|
+
);
|
|
33
173
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
174
|
+
}
|
|
175
|
+
async function at(t) {
|
|
176
|
+
return `0x${t.getState().chainId.toString(16)}`;
|
|
177
|
+
}
|
|
178
|
+
async function nt() {
|
|
179
|
+
await w() && await H();
|
|
180
|
+
}
|
|
181
|
+
function rt(t, e) {
|
|
182
|
+
const a = Number.parseInt(t[0].chainId, 16);
|
|
183
|
+
e.getState().setChainId(a);
|
|
184
|
+
}
|
|
185
|
+
async function st(t, e) {
|
|
186
|
+
const a = t[0].calls, n = (await S()).evmSmartAccounts?.[0], i = e.getState().chainId;
|
|
187
|
+
if (!I(i))
|
|
188
|
+
throw new u(
|
|
189
|
+
o.rpc.invalidParams,
|
|
190
|
+
"Chain ID is not supported for user operations"
|
|
191
|
+
);
|
|
192
|
+
try {
|
|
193
|
+
return (await b({
|
|
194
|
+
evmSmartAccount: n,
|
|
195
|
+
calls: q(a),
|
|
196
|
+
network: m[i]
|
|
197
|
+
})).userOperationHash;
|
|
198
|
+
} catch (s) {
|
|
199
|
+
throw console.log("User operation failed", s), new u(
|
|
200
|
+
o.rpc.transactionRejected,
|
|
201
|
+
s instanceof Error ? s.message : "User operation failed"
|
|
202
|
+
);
|
|
38
203
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
)
|
|
204
|
+
}
|
|
205
|
+
async function ot(t, e) {
|
|
206
|
+
const a = t[0], n = (await S()).evmSmartAccounts?.[0], i = e.getState().chainId;
|
|
207
|
+
if (!I(i) || !m[i])
|
|
208
|
+
throw new u(
|
|
209
|
+
o.rpc.invalidParams,
|
|
210
|
+
"Chain ID is not supported for user operations"
|
|
211
|
+
);
|
|
212
|
+
try {
|
|
213
|
+
const s = await R({
|
|
214
|
+
userOperationHash: a,
|
|
215
|
+
evmSmartAccount: n,
|
|
216
|
+
network: m[i]
|
|
217
|
+
});
|
|
218
|
+
return B(s);
|
|
219
|
+
} catch (s) {
|
|
220
|
+
throw console.log("Failed to get user operation status", s), new u(
|
|
221
|
+
o.rpc.internal,
|
|
222
|
+
"Failed to get user operation status"
|
|
223
|
+
);
|
|
47
224
|
}
|
|
48
|
-
|
|
225
|
+
}
|
|
226
|
+
async function it() {
|
|
227
|
+
return !(await v()).evmSmartAccounts?.length ? {} : Object.keys(m).reduce(
|
|
228
|
+
(r, n) => {
|
|
229
|
+
const d = T(Number(n));
|
|
230
|
+
return r[d] = {
|
|
231
|
+
atomic: { status: "supported" },
|
|
232
|
+
paymasterService: { supported: !0 }
|
|
233
|
+
}, r;
|
|
234
|
+
},
|
|
235
|
+
{}
|
|
236
|
+
);
|
|
49
237
|
}
|
|
50
238
|
export {
|
|
51
|
-
|
|
239
|
+
Q as handleAccounts,
|
|
240
|
+
at as handleChainId,
|
|
241
|
+
nt as handleDisconnect,
|
|
242
|
+
et as handleEthSign,
|
|
243
|
+
ot as handleGetCallsStatus,
|
|
244
|
+
it as handleGetCapabilities,
|
|
245
|
+
Y as handlePersonalSign,
|
|
246
|
+
X as handleRequestAccounts,
|
|
247
|
+
st as handleSendCalls,
|
|
248
|
+
tt as handleSendTransaction,
|
|
249
|
+
Z as handleSignTypedData,
|
|
250
|
+
rt as handleSwitchEthereumChain,
|
|
251
|
+
q as shimProviderCallsRequest,
|
|
252
|
+
f as shimProviderTxRequest
|
|
52
253
|
};
|
|
@@ -1,30 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
t = 1 - f;
|
|
13
|
-
else {
|
|
14
|
-
if (t === e)
|
|
15
|
-
return r ? NaN : (p ? -1 : 1) * (1 / 0);
|
|
16
|
-
r = r + Math.pow(2, w), t = t - f;
|
|
1
|
+
import { chainConfig as a } from "./index.native108.js";
|
|
2
|
+
import { defineChain as t } from "./index.native45.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"]
|
|
17
12
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
+
});
|
|
28
56
|
export {
|
|
29
|
-
|
|
57
|
+
r as baseSepolia
|
|
30
58
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import "@coinbase/cdp-api-client";
|
|
2
|
+
import "viem";
|
|
3
|
+
const n = {
|
|
2
4
|
/**
|
|
3
5
|
* Retrieves a value from AsyncStorage.
|
|
4
6
|
*
|
|
5
7
|
* @param key - The storage key.
|
|
6
8
|
* @returns Promise that resolves to the value.
|
|
7
9
|
*/
|
|
8
|
-
async getItem(
|
|
10
|
+
async getItem(t) {
|
|
9
11
|
try {
|
|
10
12
|
const { default: e } = await import("@react-native-async-storage/async-storage");
|
|
11
|
-
return await e.getItem(
|
|
13
|
+
return await e.getItem(t);
|
|
12
14
|
} catch (e) {
|
|
13
15
|
if (e instanceof Error && e.message.includes("Cannot resolve module"))
|
|
14
16
|
throw new Error(
|
|
@@ -23,14 +25,14 @@ const r = {
|
|
|
23
25
|
* @param key - The storage key.
|
|
24
26
|
* @param value - The value to store.
|
|
25
27
|
*/
|
|
26
|
-
async setItem(
|
|
28
|
+
async setItem(t, e) {
|
|
27
29
|
try {
|
|
28
|
-
const { default:
|
|
29
|
-
await
|
|
30
|
-
} catch (
|
|
31
|
-
throw
|
|
30
|
+
const { default: a } = await import("@react-native-async-storage/async-storage");
|
|
31
|
+
await a.setItem(t, e);
|
|
32
|
+
} catch (a) {
|
|
33
|
+
throw a instanceof Error && a.message.includes("Cannot resolve module") ? new Error(
|
|
32
34
|
"AsyncStorage is not available. Please install @react-native-async-storage/async-storage and ensure it's properly linked in your React Native project."
|
|
33
|
-
) : (console.warn(`Failed to set item in AsyncStorage: ${
|
|
35
|
+
) : (console.warn(`Failed to set item in AsyncStorage: ${a}`), a);
|
|
34
36
|
}
|
|
35
37
|
},
|
|
36
38
|
/**
|
|
@@ -38,10 +40,10 @@ const r = {
|
|
|
38
40
|
*
|
|
39
41
|
* @param key - The storage key.
|
|
40
42
|
*/
|
|
41
|
-
async removeItem(
|
|
43
|
+
async removeItem(t) {
|
|
42
44
|
try {
|
|
43
45
|
const { default: e } = await import("@react-native-async-storage/async-storage");
|
|
44
|
-
await e.removeItem(
|
|
46
|
+
await e.removeItem(t);
|
|
45
47
|
} catch (e) {
|
|
46
48
|
throw e instanceof Error && e.message.includes("Cannot resolve module") ? new Error(
|
|
47
49
|
"AsyncStorage is not available. Please install @react-native-async-storage/async-storage and ensure it's properly linked in your React Native project."
|
|
@@ -55,15 +57,15 @@ const r = {
|
|
|
55
57
|
*/
|
|
56
58
|
async clear() {
|
|
57
59
|
try {
|
|
58
|
-
const { default:
|
|
59
|
-
await
|
|
60
|
-
} catch (
|
|
61
|
-
throw
|
|
60
|
+
const { default: t } = await import("@react-native-async-storage/async-storage");
|
|
61
|
+
await t.clear();
|
|
62
|
+
} catch (t) {
|
|
63
|
+
throw t instanceof Error && t.message.includes("Cannot resolve module") ? new Error(
|
|
62
64
|
"AsyncStorage is not available. Please install @react-native-async-storage/async-storage and ensure it's properly linked in your React Native project."
|
|
63
|
-
) : (console.warn(`Failed to clear AsyncStorage: ${
|
|
65
|
+
) : (console.warn(`Failed to clear AsyncStorage: ${t}`), t);
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
};
|
|
67
69
|
export {
|
|
68
|
-
|
|
70
|
+
n as nativeStorage
|
|
69
71
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import "@coinbase/cdp-api-client";
|
|
2
|
+
import "viem";
|
|
1
3
|
let r = null;
|
|
2
|
-
function
|
|
4
|
+
function n(t) {
|
|
3
5
|
r = t;
|
|
4
6
|
}
|
|
5
7
|
function e() {
|
|
@@ -9,19 +11,19 @@ function e() {
|
|
|
9
11
|
);
|
|
10
12
|
return r;
|
|
11
13
|
}
|
|
12
|
-
function
|
|
14
|
+
function i() {
|
|
13
15
|
return e().crypto;
|
|
14
16
|
}
|
|
15
|
-
function
|
|
17
|
+
function u() {
|
|
16
18
|
return e().storage;
|
|
17
19
|
}
|
|
18
|
-
function
|
|
20
|
+
function p() {
|
|
19
21
|
return e().oauth;
|
|
20
22
|
}
|
|
21
23
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
i as getPlatformCrypto,
|
|
25
|
+
p as getPlatformOAuth,
|
|
24
26
|
e as getPlatformServices,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
u as getPlatformStorage,
|
|
28
|
+
n as setPlatformServices
|
|
27
29
|
};
|
package/dist/esm/index.web100.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { sha256 as m } from "./index.web70.js";
|
|
3
|
-
function f(t) {
|
|
4
|
-
const { commitment: e, version: s = 1 } = t, n = t.to ?? (typeof e == "string" ? "hex" : "bytes"), o = m(e);
|
|
5
|
-
return o.set([s], 0), n === "bytes" ? o : i(o);
|
|
6
|
-
}
|
|
1
|
+
const o = "2.33.0";
|
|
7
2
|
export {
|
|
8
|
-
|
|
3
|
+
o as version
|
|
9
4
|
};
|
package/dist/esm/index.web101.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
alphabet: "base64url"
|
|
1
|
+
import { BaseError as o } from "./index.web71.js";
|
|
2
|
+
class i extends o {
|
|
3
|
+
constructor({ offset: e }) {
|
|
4
|
+
super(`Offset \`${e}\` cannot be negative.`, {
|
|
5
|
+
name: "NegativeOffsetError"
|
|
7
6
|
});
|
|
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.");
|
|
14
7
|
}
|
|
15
8
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
class n extends o {
|
|
10
|
+
constructor({ length: e, position: r }) {
|
|
11
|
+
super(`Position \`${r}\` is out of bounds (\`0 < position < ${e}\`).`, { name: "PositionOutOfBoundsError" });
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
class c extends o {
|
|
15
|
+
constructor({ count: e, limit: r }) {
|
|
16
|
+
super(`Recursive read limit of \`${r}\` exceeded (recursive read count: \`${e}\`).`, { name: "RecursiveReadLimitExceededError" });
|
|
17
|
+
}
|
|
19
18
|
}
|
|
20
19
|
export {
|
|
21
|
-
i as
|
|
22
|
-
|
|
20
|
+
i as NegativeOffsetError,
|
|
21
|
+
n as PositionOutOfBoundsError,
|
|
22
|
+
c as RecursiveReadLimitExceededError
|
|
23
23
|
};
|
package/dist/esm/index.web102.js
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
1
|
+
const o = /* @__PURE__ */ BigInt(4294967295), i = /* @__PURE__ */ BigInt(32);
|
|
2
|
+
function s(t, r = !1) {
|
|
3
|
+
return r ? { h: Number(t & o), l: Number(t >> i & o) } : { h: Number(t >> i & o) | 0, l: Number(t & o) | 0 };
|
|
4
|
+
}
|
|
5
|
+
function h(t, r = !1) {
|
|
6
|
+
const n = t.length;
|
|
7
|
+
let l = new Uint32Array(n), c = new Uint32Array(n);
|
|
8
|
+
for (let e = 0; e < n; e++) {
|
|
9
|
+
const { h: u, l: f } = s(t[e], r);
|
|
10
|
+
[l[e], c[e]] = [u, f];
|
|
11
|
+
}
|
|
12
|
+
return [l, c];
|
|
13
|
+
}
|
|
14
|
+
const m = (t, r, n) => t << n | r >>> 32 - n, A = (t, r, n) => r << n | t >>> 32 - n, B = (t, r, n) => r << n - 32 | t >>> 64 - n, a = (t, r, n) => t << n - 32 | r >>> 64 - n;
|
|
10
15
|
export {
|
|
11
|
-
|
|
16
|
+
s as fromBig,
|
|
17
|
+
B as rotlBH,
|
|
18
|
+
a as rotlBL,
|
|
19
|
+
m as rotlSH,
|
|
20
|
+
A as rotlSL,
|
|
21
|
+
h as split
|
|
12
22
|
};
|