@cartridge/controller-wasm 0.3.10 → 0.3.12
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/package.json +1 -1
- package/pkg-controller/account_wasm.d.ts +59 -1
- package/pkg-controller/account_wasm_bg.js +312 -29
- package/pkg-controller/account_wasm_bg.wasm +0 -0
- package/pkg-session/session_wasm.d.ts +8 -1
- package/pkg-session/session_wasm_bg.js +2 -1
- package/pkg-session/session_wasm_bg.wasm +0 -0
package/package.json
CHANGED
|
@@ -92,6 +92,7 @@ export enum ErrorCode {
|
|
|
92
92
|
InvalidChainId = 141,
|
|
93
93
|
SessionRefreshRequired = 142,
|
|
94
94
|
ManualExecutionRequired = 143,
|
|
95
|
+
ForbiddenEntrypoint = 144,
|
|
95
96
|
}
|
|
96
97
|
export interface JsCall {
|
|
97
98
|
contractAddress: JsFelt;
|
|
@@ -150,7 +151,13 @@ export interface TypedDataPolicy {
|
|
|
150
151
|
authorized?: boolean;
|
|
151
152
|
}
|
|
152
153
|
|
|
153
|
-
export
|
|
154
|
+
export interface ApprovalPolicy {
|
|
155
|
+
target: JsFelt;
|
|
156
|
+
spender: JsFelt;
|
|
157
|
+
amount: JsFelt;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export type Policy = CallPolicy | TypedDataPolicy | ApprovalPolicy;
|
|
154
161
|
|
|
155
162
|
export type JsRegister = RegisterInput;
|
|
156
163
|
|
|
@@ -328,6 +335,18 @@ export class ControllerFactory {
|
|
|
328
335
|
*/
|
|
329
336
|
static apiLogin(app_id: string, username: string, class_hash: JsFelt, rpc_url: string, address: JsFelt, owner: Owner, cartridge_api_url: string): Promise<CartridgeAccountWithMeta>;
|
|
330
337
|
}
|
|
338
|
+
/**
|
|
339
|
+
* JavaScript-friendly chain configuration
|
|
340
|
+
*/
|
|
341
|
+
export class JsChainConfig {
|
|
342
|
+
free(): void;
|
|
343
|
+
[Symbol.dispose](): void;
|
|
344
|
+
constructor(class_hash: JsFelt, rpc_url: string, owner: Owner, address?: JsFelt | null);
|
|
345
|
+
readonly class_hash: JsFelt;
|
|
346
|
+
readonly rpc_url: string;
|
|
347
|
+
readonly owner: Owner;
|
|
348
|
+
readonly address: JsFelt | undefined;
|
|
349
|
+
}
|
|
331
350
|
export class JsControllerError {
|
|
332
351
|
private constructor();
|
|
333
352
|
free(): void;
|
|
@@ -343,3 +362,42 @@ export class LoginResult {
|
|
|
343
362
|
[Symbol.dispose](): void;
|
|
344
363
|
intoValues(): Array<any>;
|
|
345
364
|
}
|
|
365
|
+
/**
|
|
366
|
+
* WASM bindings for MultiChainController
|
|
367
|
+
*/
|
|
368
|
+
export class MultiChainAccount {
|
|
369
|
+
private constructor();
|
|
370
|
+
free(): void;
|
|
371
|
+
[Symbol.dispose](): void;
|
|
372
|
+
/**
|
|
373
|
+
* Creates a new MultiChainAccount with multiple chain configurations
|
|
374
|
+
*/
|
|
375
|
+
static create(app_id: string, username: string, chain_configs: JsChainConfig[], cartridge_api_url: string): Promise<MultiChainAccount>;
|
|
376
|
+
/**
|
|
377
|
+
* Loads a MultiChainAccount from storage
|
|
378
|
+
*/
|
|
379
|
+
static fromStorage(app_id: string, cartridge_api_url: string): Promise<MultiChainAccount | undefined>;
|
|
380
|
+
/**
|
|
381
|
+
* Adds a new chain configuration
|
|
382
|
+
*/
|
|
383
|
+
addChain(config: JsChainConfig): Promise<void>;
|
|
384
|
+
/**
|
|
385
|
+
* Removes a chain configuration
|
|
386
|
+
*/
|
|
387
|
+
removeChain(chain_id: JsFelt): Promise<void>;
|
|
388
|
+
/**
|
|
389
|
+
* Gets an account instance for a specific chain
|
|
390
|
+
*/
|
|
391
|
+
controller(chain_id: JsFelt): Promise<CartridgeAccount>;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Metadata for displaying multi-chain information
|
|
395
|
+
*/
|
|
396
|
+
export class MultiChainAccountMeta {
|
|
397
|
+
private constructor();
|
|
398
|
+
free(): void;
|
|
399
|
+
[Symbol.dispose](): void;
|
|
400
|
+
readonly app_id: string;
|
|
401
|
+
readonly username: string;
|
|
402
|
+
readonly chains: JsFelt[];
|
|
403
|
+
}
|
|
@@ -218,7 +218,7 @@ state => {
|
|
|
218
218
|
}
|
|
219
219
|
);
|
|
220
220
|
|
|
221
|
-
function
|
|
221
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
222
222
|
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
223
223
|
const real = (...args) => {
|
|
224
224
|
|
|
@@ -226,12 +226,16 @@ function makeClosure(arg0, arg1, dtor, f) {
|
|
|
226
226
|
// count. This ensures that the Rust closure environment won't
|
|
227
227
|
// be deallocated while we're invoking it.
|
|
228
228
|
state.cnt++;
|
|
229
|
+
const a = state.a;
|
|
230
|
+
state.a = 0;
|
|
229
231
|
try {
|
|
230
|
-
return f(
|
|
232
|
+
return f(a, state.b, ...args);
|
|
231
233
|
} finally {
|
|
232
234
|
if (--state.cnt === 0) {
|
|
233
|
-
wasm.__wbindgen_export_4.get(state.dtor)(
|
|
235
|
+
wasm.__wbindgen_export_4.get(state.dtor)(a, state.b);
|
|
234
236
|
CLOSURE_DTORS.unregister(state);
|
|
237
|
+
} else {
|
|
238
|
+
state.a = a;
|
|
235
239
|
}
|
|
236
240
|
}
|
|
237
241
|
};
|
|
@@ -240,7 +244,7 @@ function makeClosure(arg0, arg1, dtor, f) {
|
|
|
240
244
|
return real;
|
|
241
245
|
}
|
|
242
246
|
|
|
243
|
-
function
|
|
247
|
+
function makeClosure(arg0, arg1, dtor, f) {
|
|
244
248
|
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
245
249
|
const real = (...args) => {
|
|
246
250
|
|
|
@@ -248,16 +252,12 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|
|
248
252
|
// count. This ensures that the Rust closure environment won't
|
|
249
253
|
// be deallocated while we're invoking it.
|
|
250
254
|
state.cnt++;
|
|
251
|
-
const a = state.a;
|
|
252
|
-
state.a = 0;
|
|
253
255
|
try {
|
|
254
|
-
return f(a, state.b, ...args);
|
|
256
|
+
return f(state.a, state.b, ...args);
|
|
255
257
|
} finally {
|
|
256
258
|
if (--state.cnt === 0) {
|
|
257
|
-
wasm.__wbindgen_export_4.get(state.dtor)(a, state.b);
|
|
259
|
+
wasm.__wbindgen_export_4.get(state.dtor)(state.a, state.b); state.a = 0;
|
|
258
260
|
CLOSURE_DTORS.unregister(state);
|
|
259
|
-
} else {
|
|
260
|
-
state.a = a;
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
};
|
|
@@ -308,6 +308,21 @@ export function computeAccountAddress(class_hash, owner, salt) {
|
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
+
function _assertClass(instance, klass) {
|
|
312
|
+
if (!(instance instanceof klass)) {
|
|
313
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
318
|
+
ptr = ptr >>> 0;
|
|
319
|
+
const mem = getDataViewMemory0();
|
|
320
|
+
const result = [];
|
|
321
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
322
|
+
result.push(takeObject(mem.getUint32(i, true)));
|
|
323
|
+
}
|
|
324
|
+
return result;
|
|
325
|
+
}
|
|
311
326
|
/**
|
|
312
327
|
* Subscribes to the creation of a session for a given controller, session_key_guid and cartridge api url.
|
|
313
328
|
* The goal of this function is to know from any place when the register session flow has been completed, and to
|
|
@@ -332,24 +347,24 @@ export function signerToGuid(signer) {
|
|
|
332
347
|
return takeObject(ret);
|
|
333
348
|
}
|
|
334
349
|
|
|
335
|
-
function __wbg_adapter_8(arg0, arg1) {
|
|
336
|
-
wasm.__wbindgen_export_5(arg0, arg1);
|
|
350
|
+
function __wbg_adapter_8(arg0, arg1, arg2) {
|
|
351
|
+
wasm.__wbindgen_export_5(arg0, arg1, addHeapObject(arg2));
|
|
337
352
|
}
|
|
338
353
|
|
|
339
354
|
function __wbg_adapter_11(arg0, arg1, arg2) {
|
|
340
355
|
wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2));
|
|
341
356
|
}
|
|
342
357
|
|
|
343
|
-
function
|
|
344
|
-
wasm.__wbindgen_export_7(arg0, arg1
|
|
358
|
+
function __wbg_adapter_16(arg0, arg1) {
|
|
359
|
+
wasm.__wbindgen_export_7(arg0, arg1);
|
|
345
360
|
}
|
|
346
361
|
|
|
347
|
-
function
|
|
362
|
+
function __wbg_adapter_276(arg0, arg1, arg2, arg3) {
|
|
348
363
|
wasm.__wbindgen_export_8(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
349
364
|
}
|
|
350
365
|
|
|
351
366
|
/**
|
|
352
|
-
* @enum {1 | 20 | 24 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 40 | 41 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 10 | 64 | 65 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143}
|
|
367
|
+
* @enum {1 | 20 | 24 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 40 | 41 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 10 | 64 | 65 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144}
|
|
353
368
|
*/
|
|
354
369
|
export const ErrorCode = Object.freeze({
|
|
355
370
|
StarknetFailedToReceiveTransaction: 1, "1": "StarknetFailedToReceiveTransaction",
|
|
@@ -422,6 +437,7 @@ export const ErrorCode = Object.freeze({
|
|
|
422
437
|
InvalidChainId: 141, "141": "InvalidChainId",
|
|
423
438
|
SessionRefreshRequired: 142, "142": "SessionRefreshRequired",
|
|
424
439
|
ManualExecutionRequired: 143, "143": "ManualExecutionRequired",
|
|
440
|
+
ForbiddenEntrypoint: 144, "144": "ForbiddenEntrypoint",
|
|
425
441
|
});
|
|
426
442
|
|
|
427
443
|
const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
|
|
@@ -1087,6 +1103,89 @@ export class ControllerFactory {
|
|
|
1087
1103
|
}
|
|
1088
1104
|
if (Symbol.dispose) ControllerFactory.prototype[Symbol.dispose] = ControllerFactory.prototype.free;
|
|
1089
1105
|
|
|
1106
|
+
const JsChainConfigFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1107
|
+
? { register: () => {}, unregister: () => {} }
|
|
1108
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_jschainconfig_free(ptr >>> 0, 1));
|
|
1109
|
+
/**
|
|
1110
|
+
* JavaScript-friendly chain configuration
|
|
1111
|
+
*/
|
|
1112
|
+
export class JsChainConfig {
|
|
1113
|
+
|
|
1114
|
+
static __unwrap(jsValue) {
|
|
1115
|
+
if (!(jsValue instanceof JsChainConfig)) {
|
|
1116
|
+
return 0;
|
|
1117
|
+
}
|
|
1118
|
+
return jsValue.__destroy_into_raw();
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
__destroy_into_raw() {
|
|
1122
|
+
const ptr = this.__wbg_ptr;
|
|
1123
|
+
this.__wbg_ptr = 0;
|
|
1124
|
+
JsChainConfigFinalization.unregister(this);
|
|
1125
|
+
return ptr;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
free() {
|
|
1129
|
+
const ptr = this.__destroy_into_raw();
|
|
1130
|
+
wasm.__wbg_jschainconfig_free(ptr, 0);
|
|
1131
|
+
}
|
|
1132
|
+
/**
|
|
1133
|
+
* @param {JsFelt} class_hash
|
|
1134
|
+
* @param {string} rpc_url
|
|
1135
|
+
* @param {Owner} owner
|
|
1136
|
+
* @param {JsFelt | null} [address]
|
|
1137
|
+
*/
|
|
1138
|
+
constructor(class_hash, rpc_url, owner, address) {
|
|
1139
|
+
const ptr0 = passStringToWasm0(rpc_url, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1140
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1141
|
+
const ret = wasm.jschainconfig_new(addHeapObject(class_hash), ptr0, len0, addHeapObject(owner), isLikeNone(address) ? 0 : addHeapObject(address));
|
|
1142
|
+
this.__wbg_ptr = ret >>> 0;
|
|
1143
|
+
JsChainConfigFinalization.register(this, this.__wbg_ptr, this);
|
|
1144
|
+
return this;
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* @returns {JsFelt}
|
|
1148
|
+
*/
|
|
1149
|
+
get class_hash() {
|
|
1150
|
+
const ret = wasm.jschainconfig_class_hash(this.__wbg_ptr);
|
|
1151
|
+
return takeObject(ret);
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* @returns {string}
|
|
1155
|
+
*/
|
|
1156
|
+
get rpc_url() {
|
|
1157
|
+
let deferred1_0;
|
|
1158
|
+
let deferred1_1;
|
|
1159
|
+
try {
|
|
1160
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1161
|
+
wasm.jschainconfig_rpc_url(retptr, this.__wbg_ptr);
|
|
1162
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1163
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1164
|
+
deferred1_0 = r0;
|
|
1165
|
+
deferred1_1 = r1;
|
|
1166
|
+
return getStringFromWasm0(r0, r1);
|
|
1167
|
+
} finally {
|
|
1168
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1169
|
+
wasm.__wbindgen_export_3(deferred1_0, deferred1_1, 1);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* @returns {Owner}
|
|
1174
|
+
*/
|
|
1175
|
+
get owner() {
|
|
1176
|
+
const ret = wasm.jschainconfig_owner(this.__wbg_ptr);
|
|
1177
|
+
return takeObject(ret);
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* @returns {JsFelt | undefined}
|
|
1181
|
+
*/
|
|
1182
|
+
get address() {
|
|
1183
|
+
const ret = wasm.jschainconfig_address(this.__wbg_ptr);
|
|
1184
|
+
return takeObject(ret);
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
if (Symbol.dispose) JsChainConfig.prototype[Symbol.dispose] = JsChainConfig.prototype.free;
|
|
1188
|
+
|
|
1090
1189
|
const JsControllerErrorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1091
1190
|
? { register: () => {}, unregister: () => {} }
|
|
1092
1191
|
: new FinalizationRegistry(ptr => wasm.__wbg_jscontrollererror_free(ptr >>> 0, 1));
|
|
@@ -1218,6 +1317,175 @@ export class LoginResult {
|
|
|
1218
1317
|
}
|
|
1219
1318
|
if (Symbol.dispose) LoginResult.prototype[Symbol.dispose] = LoginResult.prototype.free;
|
|
1220
1319
|
|
|
1320
|
+
const MultiChainAccountFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1321
|
+
? { register: () => {}, unregister: () => {} }
|
|
1322
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_multichainaccount_free(ptr >>> 0, 1));
|
|
1323
|
+
/**
|
|
1324
|
+
* WASM bindings for MultiChainController
|
|
1325
|
+
*/
|
|
1326
|
+
export class MultiChainAccount {
|
|
1327
|
+
|
|
1328
|
+
static __wrap(ptr) {
|
|
1329
|
+
ptr = ptr >>> 0;
|
|
1330
|
+
const obj = Object.create(MultiChainAccount.prototype);
|
|
1331
|
+
obj.__wbg_ptr = ptr;
|
|
1332
|
+
MultiChainAccountFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1333
|
+
return obj;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
__destroy_into_raw() {
|
|
1337
|
+
const ptr = this.__wbg_ptr;
|
|
1338
|
+
this.__wbg_ptr = 0;
|
|
1339
|
+
MultiChainAccountFinalization.unregister(this);
|
|
1340
|
+
return ptr;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
free() {
|
|
1344
|
+
const ptr = this.__destroy_into_raw();
|
|
1345
|
+
wasm.__wbg_multichainaccount_free(ptr, 0);
|
|
1346
|
+
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Creates a new MultiChainAccount with multiple chain configurations
|
|
1349
|
+
* @param {string} app_id
|
|
1350
|
+
* @param {string} username
|
|
1351
|
+
* @param {JsChainConfig[]} chain_configs
|
|
1352
|
+
* @param {string} cartridge_api_url
|
|
1353
|
+
* @returns {Promise<MultiChainAccount>}
|
|
1354
|
+
*/
|
|
1355
|
+
static create(app_id, username, chain_configs, cartridge_api_url) {
|
|
1356
|
+
const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1357
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1358
|
+
const ptr1 = passStringToWasm0(username, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1359
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1360
|
+
const ptr2 = passArrayJsValueToWasm0(chain_configs, wasm.__wbindgen_export_0);
|
|
1361
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1362
|
+
const ptr3 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1363
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1364
|
+
const ret = wasm.multichainaccount_create(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1365
|
+
return takeObject(ret);
|
|
1366
|
+
}
|
|
1367
|
+
/**
|
|
1368
|
+
* Loads a MultiChainAccount from storage
|
|
1369
|
+
* @param {string} app_id
|
|
1370
|
+
* @param {string} cartridge_api_url
|
|
1371
|
+
* @returns {Promise<MultiChainAccount | undefined>}
|
|
1372
|
+
*/
|
|
1373
|
+
static fromStorage(app_id, cartridge_api_url) {
|
|
1374
|
+
const ptr0 = passStringToWasm0(app_id, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1375
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1376
|
+
const ptr1 = passStringToWasm0(cartridge_api_url, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1377
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1378
|
+
const ret = wasm.multichainaccount_fromStorage(ptr0, len0, ptr1, len1);
|
|
1379
|
+
return takeObject(ret);
|
|
1380
|
+
}
|
|
1381
|
+
/**
|
|
1382
|
+
* Adds a new chain configuration
|
|
1383
|
+
* @param {JsChainConfig} config
|
|
1384
|
+
* @returns {Promise<void>}
|
|
1385
|
+
*/
|
|
1386
|
+
addChain(config) {
|
|
1387
|
+
_assertClass(config, JsChainConfig);
|
|
1388
|
+
var ptr0 = config.__destroy_into_raw();
|
|
1389
|
+
const ret = wasm.multichainaccount_addChain(this.__wbg_ptr, ptr0);
|
|
1390
|
+
return takeObject(ret);
|
|
1391
|
+
}
|
|
1392
|
+
/**
|
|
1393
|
+
* Removes a chain configuration
|
|
1394
|
+
* @param {JsFelt} chain_id
|
|
1395
|
+
* @returns {Promise<void>}
|
|
1396
|
+
*/
|
|
1397
|
+
removeChain(chain_id) {
|
|
1398
|
+
const ret = wasm.multichainaccount_removeChain(this.__wbg_ptr, addHeapObject(chain_id));
|
|
1399
|
+
return takeObject(ret);
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Gets an account instance for a specific chain
|
|
1403
|
+
* @param {JsFelt} chain_id
|
|
1404
|
+
* @returns {Promise<CartridgeAccount>}
|
|
1405
|
+
*/
|
|
1406
|
+
controller(chain_id) {
|
|
1407
|
+
const ret = wasm.multichainaccount_controller(this.__wbg_ptr, addHeapObject(chain_id));
|
|
1408
|
+
return takeObject(ret);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
if (Symbol.dispose) MultiChainAccount.prototype[Symbol.dispose] = MultiChainAccount.prototype.free;
|
|
1412
|
+
|
|
1413
|
+
const MultiChainAccountMetaFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1414
|
+
? { register: () => {}, unregister: () => {} }
|
|
1415
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_multichainaccountmeta_free(ptr >>> 0, 1));
|
|
1416
|
+
/**
|
|
1417
|
+
* Metadata for displaying multi-chain information
|
|
1418
|
+
*/
|
|
1419
|
+
export class MultiChainAccountMeta {
|
|
1420
|
+
|
|
1421
|
+
__destroy_into_raw() {
|
|
1422
|
+
const ptr = this.__wbg_ptr;
|
|
1423
|
+
this.__wbg_ptr = 0;
|
|
1424
|
+
MultiChainAccountMetaFinalization.unregister(this);
|
|
1425
|
+
return ptr;
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
free() {
|
|
1429
|
+
const ptr = this.__destroy_into_raw();
|
|
1430
|
+
wasm.__wbg_multichainaccountmeta_free(ptr, 0);
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* @returns {string}
|
|
1434
|
+
*/
|
|
1435
|
+
get app_id() {
|
|
1436
|
+
let deferred1_0;
|
|
1437
|
+
let deferred1_1;
|
|
1438
|
+
try {
|
|
1439
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1440
|
+
wasm.multichainaccountmeta_app_id(retptr, this.__wbg_ptr);
|
|
1441
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1442
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1443
|
+
deferred1_0 = r0;
|
|
1444
|
+
deferred1_1 = r1;
|
|
1445
|
+
return getStringFromWasm0(r0, r1);
|
|
1446
|
+
} finally {
|
|
1447
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1448
|
+
wasm.__wbindgen_export_3(deferred1_0, deferred1_1, 1);
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
/**
|
|
1452
|
+
* @returns {string}
|
|
1453
|
+
*/
|
|
1454
|
+
get username() {
|
|
1455
|
+
let deferred1_0;
|
|
1456
|
+
let deferred1_1;
|
|
1457
|
+
try {
|
|
1458
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1459
|
+
wasm.multichainaccountmeta_username(retptr, this.__wbg_ptr);
|
|
1460
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1461
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1462
|
+
deferred1_0 = r0;
|
|
1463
|
+
deferred1_1 = r1;
|
|
1464
|
+
return getStringFromWasm0(r0, r1);
|
|
1465
|
+
} finally {
|
|
1466
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1467
|
+
wasm.__wbindgen_export_3(deferred1_0, deferred1_1, 1);
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
/**
|
|
1471
|
+
* @returns {JsFelt[]}
|
|
1472
|
+
*/
|
|
1473
|
+
get chains() {
|
|
1474
|
+
try {
|
|
1475
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1476
|
+
wasm.multichainaccountmeta_chains(retptr, this.__wbg_ptr);
|
|
1477
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1478
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1479
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
1480
|
+
wasm.__wbindgen_export_3(r0, r1 * 4, 4);
|
|
1481
|
+
return v1;
|
|
1482
|
+
} finally {
|
|
1483
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
if (Symbol.dispose) MultiChainAccountMeta.prototype[Symbol.dispose] = MultiChainAccountMeta.prototype.free;
|
|
1488
|
+
|
|
1221
1489
|
export function __wbg_Error_e17e777aac105295(arg0, arg1) {
|
|
1222
1490
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
1223
1491
|
return addHeapObject(ret);
|
|
@@ -1262,6 +1530,11 @@ export function __wbg_call_a5400b25a865cfd8() { return handleError(function (arg
|
|
|
1262
1530
|
return addHeapObject(ret);
|
|
1263
1531
|
}, arguments) };
|
|
1264
1532
|
|
|
1533
|
+
export function __wbg_cartridgeaccount_new(arg0) {
|
|
1534
|
+
const ret = CartridgeAccount.__wrap(arg0);
|
|
1535
|
+
return addHeapObject(ret);
|
|
1536
|
+
};
|
|
1537
|
+
|
|
1265
1538
|
export function __wbg_cartridgeaccountwithmeta_new(arg0) {
|
|
1266
1539
|
const ret = CartridgeAccountWithMeta.__wrap(arg0);
|
|
1267
1540
|
return addHeapObject(ret);
|
|
@@ -1438,6 +1711,11 @@ export function __wbg_iterator_f370b34483c71a1c() {
|
|
|
1438
1711
|
return addHeapObject(ret);
|
|
1439
1712
|
};
|
|
1440
1713
|
|
|
1714
|
+
export function __wbg_jschainconfig_unwrap(arg0) {
|
|
1715
|
+
const ret = JsChainConfig.__unwrap(takeObject(arg0));
|
|
1716
|
+
return ret;
|
|
1717
|
+
};
|
|
1718
|
+
|
|
1441
1719
|
export function __wbg_jscontrollererror_new(arg0) {
|
|
1442
1720
|
const ret = JsControllerError.__wrap(arg0);
|
|
1443
1721
|
return addHeapObject(ret);
|
|
@@ -1472,6 +1750,11 @@ export function __wbg_msCrypto_a61aeb35a24c1329(arg0) {
|
|
|
1472
1750
|
return addHeapObject(ret);
|
|
1473
1751
|
};
|
|
1474
1752
|
|
|
1753
|
+
export function __wbg_multichainaccount_new(arg0) {
|
|
1754
|
+
const ret = MultiChainAccount.__wrap(arg0);
|
|
1755
|
+
return addHeapObject(ret);
|
|
1756
|
+
};
|
|
1757
|
+
|
|
1475
1758
|
export function __wbg_navigator_65d5ad763926b868(arg0) {
|
|
1476
1759
|
const ret = getObject(arg0).navigator;
|
|
1477
1760
|
return addHeapObject(ret);
|
|
@@ -1504,7 +1787,7 @@ export function __wbg_new_2e3c58a15f39f5f9(arg0, arg1) {
|
|
|
1504
1787
|
const a = state0.a;
|
|
1505
1788
|
state0.a = 0;
|
|
1506
1789
|
try {
|
|
1507
|
-
return
|
|
1790
|
+
return __wbg_adapter_276(a, state0.b, arg0, arg1);
|
|
1508
1791
|
} finally {
|
|
1509
1792
|
state0.a = a;
|
|
1510
1793
|
}
|
|
@@ -1911,15 +2194,21 @@ export function __wbg_wbindgenthrow_451ec1a8469d7eb6(arg0, arg1) {
|
|
|
1911
2194
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1912
2195
|
};
|
|
1913
2196
|
|
|
2197
|
+
export function __wbindgen_cast_09156783ef72d99b(arg0, arg1) {
|
|
2198
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 998, function: Function { arguments: [Externref], shim_idx: 999, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2199
|
+
const ret = makeMutClosure(arg0, arg1, 998, __wbg_adapter_11);
|
|
2200
|
+
return addHeapObject(ret);
|
|
2201
|
+
};
|
|
2202
|
+
|
|
1914
2203
|
export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
|
|
1915
2204
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1916
2205
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
1917
2206
|
return addHeapObject(ret);
|
|
1918
2207
|
};
|
|
1919
2208
|
|
|
1920
|
-
export function
|
|
1921
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1922
|
-
const ret =
|
|
2209
|
+
export function __wbindgen_cast_7ee5a51087797a77(arg0, arg1) {
|
|
2210
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 964, function: Function { arguments: [], shim_idx: 965, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
2211
|
+
const ret = makeMutClosure(arg0, arg1, 964, __wbg_adapter_16);
|
|
1923
2212
|
return addHeapObject(ret);
|
|
1924
2213
|
};
|
|
1925
2214
|
|
|
@@ -1929,9 +2218,9 @@ export function __wbindgen_cast_9ae0607507abb057(arg0) {
|
|
|
1929
2218
|
return addHeapObject(ret);
|
|
1930
2219
|
};
|
|
1931
2220
|
|
|
1932
|
-
export function
|
|
1933
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
1934
|
-
const ret =
|
|
2221
|
+
export function __wbindgen_cast_be6c52086ee82095(arg0, arg1) {
|
|
2222
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 15, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 16, ret: Unit, inner_ret: Some(Unit) }, mutable: false }) -> Externref`.
|
|
2223
|
+
const ret = makeClosure(arg0, arg1, 15, __wbg_adapter_8);
|
|
1935
2224
|
return addHeapObject(ret);
|
|
1936
2225
|
};
|
|
1937
2226
|
|
|
@@ -1947,12 +2236,6 @@ export function __wbindgen_cast_d6cd19b81560fd6e(arg0) {
|
|
|
1947
2236
|
return addHeapObject(ret);
|
|
1948
2237
|
};
|
|
1949
2238
|
|
|
1950
|
-
export function __wbindgen_cast_ed712f6666cb3532(arg0, arg1) {
|
|
1951
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 904, function: Function { arguments: [], shim_idx: 905, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1952
|
-
const ret = makeMutClosure(arg0, arg1, 904, __wbg_adapter_8);
|
|
1953
|
-
return addHeapObject(ret);
|
|
1954
|
-
};
|
|
1955
|
-
|
|
1956
2239
|
export function __wbindgen_object_clone_ref(arg0) {
|
|
1957
2240
|
const ret = getObject(arg0);
|
|
1958
2241
|
return addHeapObject(ret);
|
|
Binary file
|
|
@@ -78,6 +78,7 @@ export enum ErrorCode {
|
|
|
78
78
|
InvalidChainId = 141,
|
|
79
79
|
SessionRefreshRequired = 142,
|
|
80
80
|
ManualExecutionRequired = 143,
|
|
81
|
+
ForbiddenEntrypoint = 144,
|
|
81
82
|
}
|
|
82
83
|
export interface JsCall {
|
|
83
84
|
contractAddress: JsFelt;
|
|
@@ -136,7 +137,13 @@ export interface TypedDataPolicy {
|
|
|
136
137
|
authorized?: boolean;
|
|
137
138
|
}
|
|
138
139
|
|
|
139
|
-
export
|
|
140
|
+
export interface ApprovalPolicy {
|
|
141
|
+
target: JsFelt;
|
|
142
|
+
spender: JsFelt;
|
|
143
|
+
amount: JsFelt;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export type Policy = CallPolicy | TypedDataPolicy | ApprovalPolicy;
|
|
140
147
|
|
|
141
148
|
export type JsRegister = RegisterInput;
|
|
142
149
|
|
|
@@ -290,7 +290,7 @@ function __wbg_adapter_171(arg0, arg1, arg2, arg3) {
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
/**
|
|
293
|
-
* @enum {1 | 20 | 24 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 40 | 41 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 10 | 64 | 65 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143}
|
|
293
|
+
* @enum {1 | 20 | 24 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 40 | 41 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 10 | 64 | 65 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144}
|
|
294
294
|
*/
|
|
295
295
|
export const ErrorCode = Object.freeze({
|
|
296
296
|
StarknetFailedToReceiveTransaction: 1, "1": "StarknetFailedToReceiveTransaction",
|
|
@@ -363,6 +363,7 @@ export const ErrorCode = Object.freeze({
|
|
|
363
363
|
InvalidChainId: 141, "141": "InvalidChainId",
|
|
364
364
|
SessionRefreshRequired: 142, "142": "SessionRefreshRequired",
|
|
365
365
|
ManualExecutionRequired: 143, "143": "ManualExecutionRequired",
|
|
366
|
+
ForbiddenEntrypoint: 144, "144": "ForbiddenEntrypoint",
|
|
366
367
|
});
|
|
367
368
|
|
|
368
369
|
const __wbindgen_enum_RequestCache = ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
|
|
Binary file
|