Skip to content

Commit c1b9ffc

Browse files
committed
fix: update wasm with fix & jslib
1 parent c2909fa commit c1b9ffc

File tree

8 files changed

+1919
-86
lines changed

8 files changed

+1919
-86
lines changed

Assets/Dojo/Plugins/WebGL/starknet.jslib

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ mergeInto(LibraryManager.library, {
107107
return buffer;
108108
},
109109
DeriveVerifyingKey: function (pk) {
110-
let signingKey = wasm_bindgen.SigningKey.fromSecretScalar(UTF8ToString(pk));
111-
let verifyingKey = wasm_bindgen.VerifyingKey.fromSigningKey(signingKey).scalar();
110+
let signingKey = new wasm_bindgen.SigningKey(UTF8ToString(pk));
111+
let verifyingKey = signingKey.verifyingKey().scalar();
112112
let bufferSize = lengthBytesUTF8(verifyingKey) + 1;
113113
let buffer = _malloc(bufferSize);
114114
stringToUTF8(verifyingKey, buffer, bufferSize);

Assets/WebGLTemplates/Dojo/TemplateData/dojo.js/dojo_c.d.ts

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,13 @@ declare namespace wasm_bindgen {
405405
* Result containing success boolean or error
406406
*/
407407
waitForTransaction(txn_hash: string): Promise<boolean>;
408+
/**
409+
* Gets the chain id of the provider
410+
*
411+
* # Returns
412+
* Result containing chain id as hex string or error
413+
*/
414+
chainId(): Promise<string>;
408415
}
409416
export class SigningKey {
410417
free(): void;
@@ -414,7 +421,7 @@ declare namespace wasm_bindgen {
414421
* # Returns
415422
* Private key as hex string
416423
*/
417-
constructor();
424+
constructor(secret_scalar: string);
418425
/**
419426
* Initializes a new signing key from a secret scalar
420427
*
@@ -424,7 +431,7 @@ declare namespace wasm_bindgen {
424431
* # Returns
425432
* Result containing signing key or error
426433
*/
427-
static fromSecretScalar(secret_scalar: string): SigningKey;
434+
static fromRandom(): SigningKey;
428435
/**
429436
* Returns the secret scalar of the signing key
430437
*
@@ -680,16 +687,6 @@ declare namespace wasm_bindgen {
680687
* Result containing verifying key or error
681688
*/
682689
constructor(verifying_key: string);
683-
/**
684-
* Derives a verifying key from a signing key
685-
*
686-
* # Parameters
687-
* * `signing_key` - Signing key as hex string
688-
*
689-
* # Returns
690-
* Result containing verifying key or error
691-
*/
692-
static fromSigningKey(signing_key: SigningKey): VerifyingKey;
693690
/**
694691
* Returns the scalar of the verifying key
695692
*
@@ -721,8 +718,8 @@ declare interface InitOutput {
721718
readonly __wbg_verifyingkey_free: (a: number, b: number) => void;
722719
readonly __wbg_typeddata_free: (a: number, b: number) => void;
723720
readonly __wbg_bytearray_free: (a: number, b: number) => void;
724-
readonly signingkey_new: () => number;
725-
readonly signingkey_fromSecretScalar: (a: number, b: number) => [number, number, number];
721+
readonly signingkey_new: (a: number, b: number) => [number, number, number];
722+
readonly signingkey_fromRandom: () => [number, number, number];
726723
readonly signingkey_secretScalar: (a: number) => [number, number, number, number];
727724
readonly signingkey_sign: (a: number, b: number, c: number) => [number, number, number];
728725
readonly signingkey_verifyingKey: (a: number) => [number, number, number];
@@ -734,6 +731,7 @@ declare interface InitOutput {
734731
readonly provider_new: (a: number, b: number) => [number, number, number];
735732
readonly provider_call: (a: number, b: any, c: any) => any;
736733
readonly provider_waitForTransaction: (a: number, b: number, c: number) => any;
734+
readonly provider_chainId: (a: number) => any;
737735
readonly account_new: (a: number, b: number, c: number, d: number, e: number) => any;
738736
readonly account_address: (a: number) => [number, number, number, number];
739737
readonly account_chainId: (a: number) => [number, number, number, number];
@@ -771,7 +769,6 @@ declare interface InitOutput {
771769
readonly toriiclient_updateTokenBalanceSubscription: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
772770
readonly toriiclient_publishMessage: (a: number, b: number, c: number, d: number, e: number) => any;
773771
readonly subscription_cancel: (a: number) => void;
774-
readonly verifyingkey_fromSigningKey: (a: number) => [number, number, number];
775772
readonly __wbg_toriiclient_free: (a: number, b: number) => void;
776773
readonly __wbg_provider_free: (a: number, b: number) => void;
777774
readonly __wbg_account_free: (a: number, b: number) => void;
@@ -799,12 +796,12 @@ declare interface InitOutput {
799796
readonly __externref_table_dealloc: (a: number) => void;
800797
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
801798
readonly __externref_drop_slice: (a: number, b: number) => void;
802-
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h117df3dc8165caf5: (a: number, b: number) => void;
803-
readonly closure1134_externref_shim: (a: number, b: number, c: any) => void;
804-
readonly closure1159_externref_shim: (a: number, b: number, c: any) => void;
805-
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9feb41257b1ba6f0: (a: number, b: number) => void;
806-
readonly closure2500_externref_shim: (a: number, b: number, c: any) => void;
807-
readonly closure2676_externref_shim: (a: number, b: number, c: any, d: any) => void;
799+
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h25a2d6c0cac360bc: (a: number, b: number) => void;
800+
readonly closure1136_externref_shim: (a: number, b: number, c: any) => void;
801+
readonly closure1161_externref_shim: (a: number, b: number, c: any) => void;
802+
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hfd0262bcce7a58a4: (a: number, b: number) => void;
803+
readonly closure2502_externref_shim: (a: number, b: number, c: any) => void;
804+
readonly closure2678_externref_shim: (a: number, b: number, c: any, d: any) => void;
808805
readonly __wbindgen_start: () => void;
809806
}
810807

Assets/WebGLTemplates/Dojo/TemplateData/dojo.js/dojo_c.js

Lines changed: 46 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -470,27 +470,27 @@ let wasm_bindgen;
470470
};
471471

472472
function __wbg_adapter_52(arg0, arg1) {
473-
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h117df3dc8165caf5(arg0, arg1);
473+
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h25a2d6c0cac360bc(arg0, arg1);
474474
}
475475

476476
function __wbg_adapter_55(arg0, arg1, arg2) {
477-
wasm.closure1134_externref_shim(arg0, arg1, arg2);
477+
wasm.closure1136_externref_shim(arg0, arg1, arg2);
478478
}
479479

480480
function __wbg_adapter_62(arg0, arg1, arg2) {
481-
wasm.closure1159_externref_shim(arg0, arg1, arg2);
481+
wasm.closure1161_externref_shim(arg0, arg1, arg2);
482482
}
483483

484484
function __wbg_adapter_69(arg0, arg1) {
485-
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9feb41257b1ba6f0(arg0, arg1);
485+
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hfd0262bcce7a58a4(arg0, arg1);
486486
}
487487

488488
function __wbg_adapter_72(arg0, arg1, arg2) {
489-
wasm.closure2500_externref_shim(arg0, arg1, arg2);
489+
wasm.closure2502_externref_shim(arg0, arg1, arg2);
490490
}
491491

492492
function __wbg_adapter_436(arg0, arg1, arg2, arg3) {
493-
wasm.closure2676_externref_shim(arg0, arg1, arg2, arg3);
493+
wasm.closure2678_externref_shim(arg0, arg1, arg2, arg3);
494494
}
495495

496496
const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
@@ -1027,6 +1027,17 @@ let wasm_bindgen;
10271027
const ret = wasm.provider_waitForTransaction(this.__wbg_ptr, ptr0, len0);
10281028
return ret;
10291029
}
1030+
/**
1031+
* Gets the chain id of the provider
1032+
*
1033+
* # Returns
1034+
* Result containing chain id as hex string or error
1035+
* @returns {Promise<string>}
1036+
*/
1037+
chainId() {
1038+
const ret = wasm.provider_chainId(this.__wbg_ptr);
1039+
return ret;
1040+
}
10301041
}
10311042
__exports.Provider = Provider;
10321043

@@ -1060,10 +1071,16 @@ let wasm_bindgen;
10601071
*
10611072
* # Returns
10621073
* Private key as hex string
1074+
* @param {string} secret_scalar
10631075
*/
1064-
constructor() {
1065-
const ret = wasm.signingkey_new();
1066-
this.__wbg_ptr = ret >>> 0;
1076+
constructor(secret_scalar) {
1077+
const ptr0 = passStringToWasm0(secret_scalar, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1078+
const len0 = WASM_VECTOR_LEN;
1079+
const ret = wasm.signingkey_new(ptr0, len0);
1080+
if (ret[2]) {
1081+
throw takeFromExternrefTable0(ret[1]);
1082+
}
1083+
this.__wbg_ptr = ret[0] >>> 0;
10671084
SigningKeyFinalization.register(this, this.__wbg_ptr, this);
10681085
return this;
10691086
}
@@ -1075,13 +1092,10 @@ let wasm_bindgen;
10751092
*
10761093
* # Returns
10771094
* Result containing signing key or error
1078-
* @param {string} secret_scalar
10791095
* @returns {SigningKey}
10801096
*/
1081-
static fromSecretScalar(secret_scalar) {
1082-
const ptr0 = passStringToWasm0(secret_scalar, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1083-
const len0 = WASM_VECTOR_LEN;
1084-
const ret = wasm.signingkey_fromSecretScalar(ptr0, len0);
1097+
static fromRandom() {
1098+
const ret = wasm.signingkey_fromRandom();
10851099
if (ret[2]) {
10861100
throw takeFromExternrefTable0(ret[1]);
10871101
}
@@ -1686,25 +1700,6 @@ let wasm_bindgen;
16861700
VerifyingKeyFinalization.register(this, this.__wbg_ptr, this);
16871701
return this;
16881702
}
1689-
/**
1690-
* Derives a verifying key from a signing key
1691-
*
1692-
* # Parameters
1693-
* * `signing_key` - Signing key as hex string
1694-
*
1695-
* # Returns
1696-
* Result containing verifying key or error
1697-
* @param {SigningKey} signing_key
1698-
* @returns {VerifyingKey}
1699-
*/
1700-
static fromSigningKey(signing_key) {
1701-
_assertClass(signing_key, SigningKey);
1702-
const ret = wasm.verifyingkey_fromSigningKey(signing_key.__wbg_ptr);
1703-
if (ret[2]) {
1704-
throw takeFromExternrefTable0(ret[1]);
1705-
}
1706-
return VerifyingKey.__wrap(ret[0]);
1707-
}
17081703
/**
17091704
* Returns the scalar of the verifying key
17101705
*
@@ -2551,40 +2546,40 @@ let wasm_bindgen;
25512546
const ret = false;
25522547
return ret;
25532548
};
2554-
imports.wbg.__wbindgen_closure_wrapper2076 = function(arg0, arg1, arg2) {
2555-
const ret = makeMutClosure(arg0, arg1, 677, __wbg_adapter_52);
2549+
imports.wbg.__wbindgen_closure_wrapper2080 = function(arg0, arg1, arg2) {
2550+
const ret = makeMutClosure(arg0, arg1, 679, __wbg_adapter_52);
25562551
return ret;
25572552
};
2558-
imports.wbg.__wbindgen_closure_wrapper3073 = function(arg0, arg1, arg2) {
2559-
const ret = makeMutClosure(arg0, arg1, 1135, __wbg_adapter_55);
2553+
imports.wbg.__wbindgen_closure_wrapper3079 = function(arg0, arg1, arg2) {
2554+
const ret = makeMutClosure(arg0, arg1, 1137, __wbg_adapter_55);
25602555
return ret;
25612556
};
2562-
imports.wbg.__wbindgen_closure_wrapper3074 = function(arg0, arg1, arg2) {
2563-
const ret = makeMutClosure(arg0, arg1, 1135, __wbg_adapter_55);
2557+
imports.wbg.__wbindgen_closure_wrapper3080 = function(arg0, arg1, arg2) {
2558+
const ret = makeMutClosure(arg0, arg1, 1137, __wbg_adapter_55);
25642559
return ret;
25652560
};
2566-
imports.wbg.__wbindgen_closure_wrapper3075 = function(arg0, arg1, arg2) {
2567-
const ret = makeMutClosure(arg0, arg1, 1135, __wbg_adapter_55);
2561+
imports.wbg.__wbindgen_closure_wrapper3081 = function(arg0, arg1, arg2) {
2562+
const ret = makeMutClosure(arg0, arg1, 1137, __wbg_adapter_55);
25682563
return ret;
25692564
};
2570-
imports.wbg.__wbindgen_closure_wrapper3117 = function(arg0, arg1, arg2) {
2571-
const ret = makeMutClosure(arg0, arg1, 1160, __wbg_adapter_62);
2565+
imports.wbg.__wbindgen_closure_wrapper3123 = function(arg0, arg1, arg2) {
2566+
const ret = makeMutClosure(arg0, arg1, 1162, __wbg_adapter_62);
25722567
return ret;
25732568
};
2574-
imports.wbg.__wbindgen_closure_wrapper3118 = function(arg0, arg1, arg2) {
2575-
const ret = makeMutClosure(arg0, arg1, 1160, __wbg_adapter_62);
2569+
imports.wbg.__wbindgen_closure_wrapper3124 = function(arg0, arg1, arg2) {
2570+
const ret = makeMutClosure(arg0, arg1, 1162, __wbg_adapter_62);
25762571
return ret;
25772572
};
2578-
imports.wbg.__wbindgen_closure_wrapper3119 = function(arg0, arg1, arg2) {
2579-
const ret = makeMutClosure(arg0, arg1, 1160, __wbg_adapter_62);
2573+
imports.wbg.__wbindgen_closure_wrapper3125 = function(arg0, arg1, arg2) {
2574+
const ret = makeMutClosure(arg0, arg1, 1162, __wbg_adapter_62);
25802575
return ret;
25812576
};
2582-
imports.wbg.__wbindgen_closure_wrapper5017 = function(arg0, arg1, arg2) {
2583-
const ret = makeMutClosure(arg0, arg1, 1932, __wbg_adapter_69);
2577+
imports.wbg.__wbindgen_closure_wrapper5027 = function(arg0, arg1, arg2) {
2578+
const ret = makeMutClosure(arg0, arg1, 1934, __wbg_adapter_69);
25842579
return ret;
25852580
};
2586-
imports.wbg.__wbindgen_closure_wrapper6321 = function(arg0, arg1, arg2) {
2587-
const ret = makeMutClosure(arg0, arg1, 2501, __wbg_adapter_72);
2581+
imports.wbg.__wbindgen_closure_wrapper6331 = function(arg0, arg1, arg2) {
2582+
const ret = makeMutClosure(arg0, arg1, 2503, __wbg_adapter_72);
25882583
return ret;
25892584
};
25902585
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {

0 commit comments

Comments
 (0)