@getpara/core-sdk 2.18.0 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/types/index.js +3 -1
- package/dist/cjs/types/smartAccounts.js +119 -0
- package/dist/cjs/utils/events.js +33 -5
- package/dist/esm/constants.js +1 -1
- package/dist/esm/index.js +13 -1
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/types/smartAccounts.js +93 -0
- package/dist/esm/utils/events.js +30 -4
- package/dist/types/index.d.ts +2 -1
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/smartAccounts.d.ts +42 -0
- package/dist/types/utils/events.d.ts +14 -1
- package/package.json +3 -3
package/dist/cjs/constants.js
CHANGED
|
@@ -46,7 +46,7 @@ __export(constants_exports, {
|
|
|
46
46
|
TRANSACTION_REVIEW_TIMEOUT_MS: () => TRANSACTION_REVIEW_TIMEOUT_MS
|
|
47
47
|
});
|
|
48
48
|
module.exports = __toCommonJS(constants_exports);
|
|
49
|
-
const PARA_CORE_VERSION = "2.
|
|
49
|
+
const PARA_CORE_VERSION = "2.19.0";
|
|
50
50
|
const PREFIX = "@CAPSULE/";
|
|
51
51
|
const PARA_PREFIX = "@PARA/";
|
|
52
52
|
const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
|
package/dist/cjs/index.js
CHANGED
|
@@ -92,6 +92,8 @@ __export(src_exports, {
|
|
|
92
92
|
isPortal: () => import_utils.isPortal,
|
|
93
93
|
isWalletSupported: () => import_wallet.isWalletSupported,
|
|
94
94
|
mpcComputationClient: () => mpcComputationClient,
|
|
95
|
+
offParaEvent: () => import_utils.offParaEvent,
|
|
96
|
+
onParaEvent: () => import_utils.onParaEvent,
|
|
95
97
|
paraVersion: () => paraVersion,
|
|
96
98
|
publicKeyFromHex: () => import_utils2.publicKeyFromHex,
|
|
97
99
|
shortenUrl: () => import_utils.shortenUrl,
|
|
@@ -102,6 +104,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
102
104
|
var import_ParaCore = require("./ParaCore.js");
|
|
103
105
|
var import_user_management_client = require("@getpara/user-management-client");
|
|
104
106
|
var import_types = require("./types/index.js");
|
|
107
|
+
__reExport(src_exports, require("./types/smartAccounts.js"), module.exports);
|
|
105
108
|
__reExport(src_exports, require("./types/coreApi.js"), module.exports);
|
|
106
109
|
__reExport(src_exports, require("./types/events.js"), module.exports);
|
|
107
110
|
__reExport(src_exports, require("./types/config.js"), module.exports);
|
|
@@ -189,11 +192,14 @@ var src_default = import_ParaCore.ParaCore;
|
|
|
189
192
|
isPortal,
|
|
190
193
|
isWalletSupported,
|
|
191
194
|
mpcComputationClient,
|
|
195
|
+
offParaEvent,
|
|
196
|
+
onParaEvent,
|
|
192
197
|
paraVersion,
|
|
193
198
|
publicKeyFromHex,
|
|
194
199
|
shortenUrl,
|
|
195
200
|
toAssetInfoArray,
|
|
196
201
|
transmissionUtilsRetrieve,
|
|
202
|
+
...require("./types/smartAccounts.js"),
|
|
197
203
|
...require("./types/coreApi.js"),
|
|
198
204
|
...require("./types/events.js"),
|
|
199
205
|
...require("./types/config.js"),
|
package/dist/cjs/types/index.js
CHANGED
|
@@ -21,6 +21,7 @@ __reExport(types_exports, require("./wallet.js"), module.exports);
|
|
|
21
21
|
__reExport(types_exports, require("./methods.js"), module.exports);
|
|
22
22
|
__reExport(types_exports, require("./popup.js"), module.exports);
|
|
23
23
|
__reExport(types_exports, require("./events.js"), module.exports);
|
|
24
|
+
__reExport(types_exports, require("./smartAccounts.js"), module.exports);
|
|
24
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
25
26
|
0 && (module.exports = {
|
|
26
27
|
...require("./accountLinking.js"),
|
|
@@ -29,5 +30,6 @@ __reExport(types_exports, require("./events.js"), module.exports);
|
|
|
29
30
|
...require("./wallet.js"),
|
|
30
31
|
...require("./methods.js"),
|
|
31
32
|
...require("./popup.js"),
|
|
32
|
-
...require("./events.js")
|
|
33
|
+
...require("./events.js"),
|
|
34
|
+
...require("./smartAccounts.js")
|
|
33
35
|
});
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var smartAccounts_exports = {};
|
|
19
|
+
__export(smartAccounts_exports, {
|
|
20
|
+
SMART_ACCOUNT_ERROR_CODES: () => SMART_ACCOUNT_ERROR_CODES,
|
|
21
|
+
SMART_ACCOUNT_PROVIDERS: () => SMART_ACCOUNT_PROVIDERS,
|
|
22
|
+
SmartAccountError: () => SmartAccountError,
|
|
23
|
+
classifyProviderError: () => classifyProviderError,
|
|
24
|
+
wrapProviderError: () => wrapProviderError
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(smartAccounts_exports);
|
|
27
|
+
const SMART_ACCOUNT_PROVIDERS = [
|
|
28
|
+
"ALCHEMY",
|
|
29
|
+
"ZERODEV",
|
|
30
|
+
"BICONOMY",
|
|
31
|
+
"GELATO",
|
|
32
|
+
"PIMLICO",
|
|
33
|
+
"SAFE",
|
|
34
|
+
"THIRDWEB",
|
|
35
|
+
"RHINESTONE",
|
|
36
|
+
"PORTO",
|
|
37
|
+
"CDP"
|
|
38
|
+
];
|
|
39
|
+
const SMART_ACCOUNT_ERROR_CODES = [
|
|
40
|
+
"MISSING_CHAIN",
|
|
41
|
+
"MISSING_ACCOUNT_ADDRESS",
|
|
42
|
+
"MISSING_API_KEY",
|
|
43
|
+
"INVALID_CONFIG",
|
|
44
|
+
// Authorization (7702)
|
|
45
|
+
"AUTHORIZATION_FAILED",
|
|
46
|
+
"DELEGATION_CONFLICT",
|
|
47
|
+
"AUTHORIZATION_NONCE_MISMATCH",
|
|
48
|
+
// Chain
|
|
49
|
+
"CHAIN_MISMATCH",
|
|
50
|
+
// Transaction Submission
|
|
51
|
+
"BUNDLER_REJECTED",
|
|
52
|
+
"GAS_ESTIMATION_FAILED",
|
|
53
|
+
"SPONSORSHIP_DENIED",
|
|
54
|
+
// Transaction Receipt
|
|
55
|
+
"RECEIPT_TIMEOUT",
|
|
56
|
+
"TRANSACTION_REVERTED",
|
|
57
|
+
"RECEIPT_MISSING",
|
|
58
|
+
// Provider
|
|
59
|
+
"PROVIDER_UNREACHABLE",
|
|
60
|
+
"PROVIDER_RATE_LIMITED",
|
|
61
|
+
"PROVIDER_ERROR"
|
|
62
|
+
];
|
|
63
|
+
class SmartAccountError extends Error {
|
|
64
|
+
constructor(params) {
|
|
65
|
+
super(params.message);
|
|
66
|
+
this.name = "SmartAccountError";
|
|
67
|
+
this.code = params.code;
|
|
68
|
+
this.provider = params.provider;
|
|
69
|
+
if (params.cause !== void 0) {
|
|
70
|
+
this.cause = params.cause;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function classifyProviderError(error) {
|
|
75
|
+
var _a;
|
|
76
|
+
const msg = (error instanceof Error ? (_a = error.message) != null ? _a : String(error) : String(error)).toLowerCase();
|
|
77
|
+
if (msg.includes("rate limit") || msg.includes("429")) {
|
|
78
|
+
return "PROVIDER_RATE_LIMITED";
|
|
79
|
+
}
|
|
80
|
+
if (msg.includes("gas") && (msg.includes("estimate") || msg.includes("estimation"))) {
|
|
81
|
+
return "GAS_ESTIMATION_FAILED";
|
|
82
|
+
}
|
|
83
|
+
if (msg.includes("paymaster") || msg.includes("sponsor")) {
|
|
84
|
+
return "SPONSORSHIP_DENIED";
|
|
85
|
+
}
|
|
86
|
+
if (msg.includes("useroperation") && (msg.includes("reverted") || msg.includes("rejected") || msg.includes("failed"))) {
|
|
87
|
+
return "BUNDLER_REJECTED";
|
|
88
|
+
}
|
|
89
|
+
if (msg.includes("nonce") && msg.includes("authorization")) {
|
|
90
|
+
return "AUTHORIZATION_NONCE_MISMATCH";
|
|
91
|
+
}
|
|
92
|
+
if (msg.includes("nonce") || msg.includes("aa25") || msg.includes("aa10")) {
|
|
93
|
+
return "BUNDLER_REJECTED";
|
|
94
|
+
}
|
|
95
|
+
if (msg.includes("authorization") || msg.includes("delegation")) {
|
|
96
|
+
return "AUTHORIZATION_FAILED";
|
|
97
|
+
}
|
|
98
|
+
if (msg.includes("econnrefused") || msg.includes("fetch failed") || msg.includes("network") || msg.includes("timeout")) {
|
|
99
|
+
return "PROVIDER_UNREACHABLE";
|
|
100
|
+
}
|
|
101
|
+
return "PROVIDER_ERROR";
|
|
102
|
+
}
|
|
103
|
+
function wrapProviderError(error, provider) {
|
|
104
|
+
var _a;
|
|
105
|
+
if (error instanceof SmartAccountError) {
|
|
106
|
+
return error;
|
|
107
|
+
}
|
|
108
|
+
const code = classifyProviderError(error);
|
|
109
|
+
const message = error instanceof Error ? (_a = error.message) != null ? _a : String(error) : String(error);
|
|
110
|
+
return new SmartAccountError({ code, message, provider, cause: error });
|
|
111
|
+
}
|
|
112
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
113
|
+
0 && (module.exports = {
|
|
114
|
+
SMART_ACCOUNT_ERROR_CODES,
|
|
115
|
+
SMART_ACCOUNT_PROVIDERS,
|
|
116
|
+
SmartAccountError,
|
|
117
|
+
classifyProviderError,
|
|
118
|
+
wrapProviderError
|
|
119
|
+
});
|
package/dist/cjs/utils/events.js
CHANGED
|
@@ -31,15 +31,43 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
var events_exports = {};
|
|
33
33
|
__export(events_exports, {
|
|
34
|
-
dispatchEvent: () => dispatchEvent
|
|
34
|
+
dispatchEvent: () => dispatchEvent,
|
|
35
|
+
offParaEvent: () => offParaEvent,
|
|
36
|
+
onParaEvent: () => onParaEvent
|
|
35
37
|
});
|
|
36
38
|
module.exports = __toCommonJS(events_exports);
|
|
39
|
+
const listeners = /* @__PURE__ */ new Map();
|
|
40
|
+
function onParaEvent(type, handler) {
|
|
41
|
+
let set = listeners.get(type);
|
|
42
|
+
if (!set) {
|
|
43
|
+
set = /* @__PURE__ */ new Set();
|
|
44
|
+
listeners.set(type, set);
|
|
45
|
+
}
|
|
46
|
+
set.add(handler);
|
|
47
|
+
return () => set.delete(handler);
|
|
48
|
+
}
|
|
49
|
+
function offParaEvent(type, handler) {
|
|
50
|
+
var _a;
|
|
51
|
+
(_a = listeners.get(type)) == null ? void 0 : _a.delete(handler);
|
|
52
|
+
}
|
|
37
53
|
function dispatchEvent(type, data, error) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
)
|
|
54
|
+
const detail = __spreadValues({ data }, error && { error: new Error(error) });
|
|
55
|
+
const set = listeners.get(type);
|
|
56
|
+
if (set) {
|
|
57
|
+
for (const handler of set) {
|
|
58
|
+
try {
|
|
59
|
+
handler({ detail });
|
|
60
|
+
} catch (e) {
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (typeof window !== "undefined" && window.dispatchEvent) {
|
|
65
|
+
window.dispatchEvent(new CustomEvent(type, { detail }));
|
|
66
|
+
}
|
|
41
67
|
}
|
|
42
68
|
// Annotate the CommonJS export names for ESM import in node:
|
|
43
69
|
0 && (module.exports = {
|
|
44
|
-
dispatchEvent
|
|
70
|
+
dispatchEvent,
|
|
71
|
+
offParaEvent,
|
|
72
|
+
onParaEvent
|
|
45
73
|
});
|
package/dist/esm/constants.js
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -33,10 +33,20 @@ import {
|
|
|
33
33
|
PregenIdentifierType,
|
|
34
34
|
AccountLinkError
|
|
35
35
|
} from "./types/index.js";
|
|
36
|
+
export * from "./types/smartAccounts.js";
|
|
36
37
|
export * from "./types/coreApi.js";
|
|
37
38
|
export * from "./types/events.js";
|
|
38
39
|
export * from "./types/config.js";
|
|
39
|
-
import {
|
|
40
|
+
import {
|
|
41
|
+
getPortalDomain,
|
|
42
|
+
dispatchEvent,
|
|
43
|
+
onParaEvent,
|
|
44
|
+
offParaEvent,
|
|
45
|
+
entityToWallet,
|
|
46
|
+
constructUrl,
|
|
47
|
+
shortenUrl,
|
|
48
|
+
isPortal
|
|
49
|
+
} from "./utils/index.js";
|
|
40
50
|
import {
|
|
41
51
|
PREFIX,
|
|
42
52
|
PARA_PREFIX,
|
|
@@ -142,6 +152,8 @@ export {
|
|
|
142
152
|
isPortal,
|
|
143
153
|
isWalletSupported,
|
|
144
154
|
mpcComputationClient,
|
|
155
|
+
offParaEvent,
|
|
156
|
+
onParaEvent,
|
|
145
157
|
paraVersion,
|
|
146
158
|
publicKeyFromHex,
|
|
147
159
|
shortenUrl,
|
package/dist/esm/types/index.js
CHANGED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import "../chunk-7B52C2XE.js";
|
|
2
|
+
const SMART_ACCOUNT_PROVIDERS = [
|
|
3
|
+
"ALCHEMY",
|
|
4
|
+
"ZERODEV",
|
|
5
|
+
"BICONOMY",
|
|
6
|
+
"GELATO",
|
|
7
|
+
"PIMLICO",
|
|
8
|
+
"SAFE",
|
|
9
|
+
"THIRDWEB",
|
|
10
|
+
"RHINESTONE",
|
|
11
|
+
"PORTO",
|
|
12
|
+
"CDP"
|
|
13
|
+
];
|
|
14
|
+
const SMART_ACCOUNT_ERROR_CODES = [
|
|
15
|
+
"MISSING_CHAIN",
|
|
16
|
+
"MISSING_ACCOUNT_ADDRESS",
|
|
17
|
+
"MISSING_API_KEY",
|
|
18
|
+
"INVALID_CONFIG",
|
|
19
|
+
// Authorization (7702)
|
|
20
|
+
"AUTHORIZATION_FAILED",
|
|
21
|
+
"DELEGATION_CONFLICT",
|
|
22
|
+
"AUTHORIZATION_NONCE_MISMATCH",
|
|
23
|
+
// Chain
|
|
24
|
+
"CHAIN_MISMATCH",
|
|
25
|
+
// Transaction Submission
|
|
26
|
+
"BUNDLER_REJECTED",
|
|
27
|
+
"GAS_ESTIMATION_FAILED",
|
|
28
|
+
"SPONSORSHIP_DENIED",
|
|
29
|
+
// Transaction Receipt
|
|
30
|
+
"RECEIPT_TIMEOUT",
|
|
31
|
+
"TRANSACTION_REVERTED",
|
|
32
|
+
"RECEIPT_MISSING",
|
|
33
|
+
// Provider
|
|
34
|
+
"PROVIDER_UNREACHABLE",
|
|
35
|
+
"PROVIDER_RATE_LIMITED",
|
|
36
|
+
"PROVIDER_ERROR"
|
|
37
|
+
];
|
|
38
|
+
class SmartAccountError extends Error {
|
|
39
|
+
constructor(params) {
|
|
40
|
+
super(params.message);
|
|
41
|
+
this.name = "SmartAccountError";
|
|
42
|
+
this.code = params.code;
|
|
43
|
+
this.provider = params.provider;
|
|
44
|
+
if (params.cause !== void 0) {
|
|
45
|
+
this.cause = params.cause;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function classifyProviderError(error) {
|
|
50
|
+
var _a;
|
|
51
|
+
const msg = (error instanceof Error ? (_a = error.message) != null ? _a : String(error) : String(error)).toLowerCase();
|
|
52
|
+
if (msg.includes("rate limit") || msg.includes("429")) {
|
|
53
|
+
return "PROVIDER_RATE_LIMITED";
|
|
54
|
+
}
|
|
55
|
+
if (msg.includes("gas") && (msg.includes("estimate") || msg.includes("estimation"))) {
|
|
56
|
+
return "GAS_ESTIMATION_FAILED";
|
|
57
|
+
}
|
|
58
|
+
if (msg.includes("paymaster") || msg.includes("sponsor")) {
|
|
59
|
+
return "SPONSORSHIP_DENIED";
|
|
60
|
+
}
|
|
61
|
+
if (msg.includes("useroperation") && (msg.includes("reverted") || msg.includes("rejected") || msg.includes("failed"))) {
|
|
62
|
+
return "BUNDLER_REJECTED";
|
|
63
|
+
}
|
|
64
|
+
if (msg.includes("nonce") && msg.includes("authorization")) {
|
|
65
|
+
return "AUTHORIZATION_NONCE_MISMATCH";
|
|
66
|
+
}
|
|
67
|
+
if (msg.includes("nonce") || msg.includes("aa25") || msg.includes("aa10")) {
|
|
68
|
+
return "BUNDLER_REJECTED";
|
|
69
|
+
}
|
|
70
|
+
if (msg.includes("authorization") || msg.includes("delegation")) {
|
|
71
|
+
return "AUTHORIZATION_FAILED";
|
|
72
|
+
}
|
|
73
|
+
if (msg.includes("econnrefused") || msg.includes("fetch failed") || msg.includes("network") || msg.includes("timeout")) {
|
|
74
|
+
return "PROVIDER_UNREACHABLE";
|
|
75
|
+
}
|
|
76
|
+
return "PROVIDER_ERROR";
|
|
77
|
+
}
|
|
78
|
+
function wrapProviderError(error, provider) {
|
|
79
|
+
var _a;
|
|
80
|
+
if (error instanceof SmartAccountError) {
|
|
81
|
+
return error;
|
|
82
|
+
}
|
|
83
|
+
const code = classifyProviderError(error);
|
|
84
|
+
const message = error instanceof Error ? (_a = error.message) != null ? _a : String(error) : String(error);
|
|
85
|
+
return new SmartAccountError({ code, message, provider, cause: error });
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
SMART_ACCOUNT_ERROR_CODES,
|
|
89
|
+
SMART_ACCOUNT_PROVIDERS,
|
|
90
|
+
SmartAccountError,
|
|
91
|
+
classifyProviderError,
|
|
92
|
+
wrapProviderError
|
|
93
|
+
};
|
package/dist/esm/utils/events.js
CHANGED
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__spreadValues
|
|
3
3
|
} from "../chunk-7B52C2XE.js";
|
|
4
|
+
const listeners = /* @__PURE__ */ new Map();
|
|
5
|
+
function onParaEvent(type, handler) {
|
|
6
|
+
let set = listeners.get(type);
|
|
7
|
+
if (!set) {
|
|
8
|
+
set = /* @__PURE__ */ new Set();
|
|
9
|
+
listeners.set(type, set);
|
|
10
|
+
}
|
|
11
|
+
set.add(handler);
|
|
12
|
+
return () => set.delete(handler);
|
|
13
|
+
}
|
|
14
|
+
function offParaEvent(type, handler) {
|
|
15
|
+
var _a;
|
|
16
|
+
(_a = listeners.get(type)) == null ? void 0 : _a.delete(handler);
|
|
17
|
+
}
|
|
4
18
|
function dispatchEvent(type, data, error) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
)
|
|
19
|
+
const detail = __spreadValues({ data }, error && { error: new Error(error) });
|
|
20
|
+
const set = listeners.get(type);
|
|
21
|
+
if (set) {
|
|
22
|
+
for (const handler of set) {
|
|
23
|
+
try {
|
|
24
|
+
handler({ detail });
|
|
25
|
+
} catch (e) {
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (typeof window !== "undefined" && window.dispatchEvent) {
|
|
30
|
+
window.dispatchEvent(new CustomEvent(type, { detail }));
|
|
31
|
+
}
|
|
8
32
|
}
|
|
9
33
|
export {
|
|
10
|
-
dispatchEvent
|
|
34
|
+
dispatchEvent,
|
|
35
|
+
offParaEvent,
|
|
36
|
+
onParaEvent
|
|
11
37
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ParaCore } from './ParaCore.js';
|
|
2
2
|
export { type Auth, type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, type VerifiedAuth, AuthMethod, type TAuthMethod, AuthMethodStatus, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, type TNetwork, WalletType, type TWalletType, WalletScheme, type TWalletScheme, OnRampAsset, type TOnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAssets, type OnRampPurchase, type OnRampAssetInfo, type ProviderAssetInfo, OnRampMethod, type Theme, OAuthMethod, type TOAuthMethod, type TLinkedAccountType, type SupportedAccountLinks, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, type LinkedAccount, type LinkedAccounts, type TExternalWallet, type ExternalWalletInfo, type PregenAuth, type Setup2faResponse, type TelegramAuthResponse, type VerifyExternalWalletParams, type AssetMetadata, type AssetMetadataIndexed, type AssetValue, type BalancesConfig, type WalletBalance, type ProfileBalance, type OfframpDepositRequest, type WalletWithMetadata, RecoveryStatus, ThemeMode, NON_ED25519, PREGEN_IDENTIFIER_TYPES, WALLET_TYPES, WALLET_SCHEMES, OAUTH_METHODS, LINKED_ACCOUNT_TYPES, EXTERNAL_WALLET_TYPES, EVM_WALLETS, SOLANA_WALLETS, COSMOS_WALLETS, formatAssetQuantity, formatCurrency, type EstimateTransactionOpts, type EstimateTransactionResult, type BroadcastTransactionOpts, type BroadcastTransactionResult, type PendingTransactionEntity, type SerializedDecodedTx, type SerializedTxData, type GetPendingTransactionResponse, } from '@getpara/user-management-client';
|
|
3
3
|
export { PopupType, PregenIdentifierType, type AuthStateSignup, type AuthStateVerify, type AuthStateLogin, type AuthState, type OAuthResponse, type CoreAuthInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type Wallet, type AvailableWallet, type AccountLinkInProgress, AccountLinkError, type InternalInterface, type Verify2faParams, type Verify2faResponse, type StorageType, type TelegramParams, } from './types/index.js';
|
|
4
|
+
export * from './types/smartAccounts.js';
|
|
4
5
|
export * from './types/coreApi.js';
|
|
5
6
|
export * from './types/events.js';
|
|
6
7
|
export * from './types/config.js';
|
|
7
|
-
export { getPortalDomain, dispatchEvent, entityToWallet, constructUrl, shortenUrl, isPortal } from './utils/index.js';
|
|
8
|
+
export { getPortalDomain, dispatchEvent, onParaEvent, offParaEvent, entityToWallet, constructUrl, shortenUrl, isPortal, } from './utils/index.js';
|
|
8
9
|
export { PREFIX as STORAGE_PREFIX, PARA_PREFIX as PARA_STORAGE_PREFIX, LOCAL_STORAGE_CURRENT_WALLET_IDS, LOCAL_STORAGE_WALLETS, } from './constants.js';
|
|
9
10
|
export { distributeNewShare } from './shares/shareDistribution.js';
|
|
10
11
|
export { KeyContainer } from './shares/KeyContainer.js';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All supported AA provider names.
|
|
3
|
+
*/
|
|
4
|
+
export declare const SMART_ACCOUNT_PROVIDERS: readonly ["ALCHEMY", "ZERODEV", "BICONOMY", "GELATO", "PIMLICO", "SAFE", "THIRDWEB", "RHINESTONE", "PORTO", "CDP"];
|
|
5
|
+
export type SmartAccountProvider = (typeof SMART_ACCOUNT_PROVIDERS)[number];
|
|
6
|
+
/**
|
|
7
|
+
* Smart account mode — the two execution models supported by AA providers.
|
|
8
|
+
* - '4337': EIP-4337 UserOperations via bundler
|
|
9
|
+
* - '7702': EIP-7702 EOA delegation (type 4 transactions)
|
|
10
|
+
*/
|
|
11
|
+
export type SmartAccountMode = '4337' | '7702';
|
|
12
|
+
/**
|
|
13
|
+
* Mixin for params that support choosing between 4337 and 7702 execution modes.
|
|
14
|
+
*/
|
|
15
|
+
export interface SmartAccountModeParam {
|
|
16
|
+
/**
|
|
17
|
+
* Account mode: EIP-4337 (bundler) or EIP-7702 (EOA delegation)
|
|
18
|
+
* @default '4337'
|
|
19
|
+
*/
|
|
20
|
+
mode?: SmartAccountMode;
|
|
21
|
+
}
|
|
22
|
+
export declare const SMART_ACCOUNT_ERROR_CODES: readonly ["MISSING_CHAIN", "MISSING_ACCOUNT_ADDRESS", "MISSING_API_KEY", "INVALID_CONFIG", "AUTHORIZATION_FAILED", "DELEGATION_CONFLICT", "AUTHORIZATION_NONCE_MISMATCH", "CHAIN_MISMATCH", "BUNDLER_REJECTED", "GAS_ESTIMATION_FAILED", "SPONSORSHIP_DENIED", "RECEIPT_TIMEOUT", "TRANSACTION_REVERTED", "RECEIPT_MISSING", "PROVIDER_UNREACHABLE", "PROVIDER_RATE_LIMITED", "PROVIDER_ERROR"];
|
|
23
|
+
export type SmartAccountErrorCode = (typeof SMART_ACCOUNT_ERROR_CODES)[number];
|
|
24
|
+
export declare class SmartAccountError extends Error {
|
|
25
|
+
readonly code: SmartAccountErrorCode;
|
|
26
|
+
readonly provider: SmartAccountProvider;
|
|
27
|
+
constructor(params: {
|
|
28
|
+
code: SmartAccountErrorCode;
|
|
29
|
+
message: string;
|
|
30
|
+
provider: SmartAccountProvider;
|
|
31
|
+
cause?: unknown;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Classifies an unknown provider error into a SmartAccountErrorCode.
|
|
36
|
+
* Inspects the error message for common patterns across AA providers.
|
|
37
|
+
*/
|
|
38
|
+
export declare function classifyProviderError(error: unknown): SmartAccountErrorCode;
|
|
39
|
+
/**
|
|
40
|
+
* Wraps an unknown error thrown by a provider SDK into a SmartAccountError.
|
|
41
|
+
*/
|
|
42
|
+
export declare function wrapProviderError(error: unknown, provider: SmartAccountProvider): SmartAccountError;
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
import { ParaEvent } from '../types/index.js';
|
|
1
|
+
import { BaseEvent, ParaEvent } from '../types/index.js';
|
|
2
|
+
type ParaEventHandler = (event: {
|
|
3
|
+
detail: BaseEvent<any>;
|
|
4
|
+
}) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Subscribe to a ParaEvent. Works on every platform (web, RN, Node).
|
|
7
|
+
* Returns an unsubscribe function.
|
|
8
|
+
*/
|
|
9
|
+
export declare function onParaEvent(type: ParaEvent, handler: ParaEventHandler): () => void;
|
|
10
|
+
/**
|
|
11
|
+
* Remove a previously registered handler.
|
|
12
|
+
*/
|
|
13
|
+
export declare function offParaEvent(type: ParaEvent, handler: ParaEventHandler): void;
|
|
2
14
|
export declare function dispatchEvent<T>(type: ParaEvent, data: T, error?: string): void;
|
|
15
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@celo/utils": "^8.0.2",
|
|
6
6
|
"@cosmjs/encoding": "^0.32.4",
|
|
7
7
|
"@ethereumjs/util": "^9.1.0",
|
|
8
|
-
"@getpara/user-management-client": "2.
|
|
8
|
+
"@getpara/user-management-client": "2.19.0",
|
|
9
9
|
"@noble/hashes": "^1.5.0",
|
|
10
10
|
"axios": "^1.8.4",
|
|
11
11
|
"base64url": "^3.0.1",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dist",
|
|
31
31
|
"package.json"
|
|
32
32
|
],
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "7dc9400777adb653c0cc28e0d9236424eb384467",
|
|
34
34
|
"main": "dist/cjs/index.js",
|
|
35
35
|
"module": "dist/esm/index.js",
|
|
36
36
|
"scripts": {
|