@starknetfoundation/krusty-kms-wasm 0.11.0 → 0.12.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/krusty_kms_wasm.d.ts +218 -63
- package/krusty_kms_wasm.js +244 -20
- package/krusty_kms_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/krusty_kms_wasm.d.ts
CHANGED
|
@@ -1008,21 +1008,59 @@ export function decryptWithKey(nonce: string, ciphertext: string, key_hex: strin
|
|
|
1008
1008
|
* Derive an Argent account contract address from a public key.
|
|
1009
1009
|
*
|
|
1010
1010
|
* Uses the standard Argent deployment (salt = public key, Starknet-key owner,
|
|
1011
|
-
* no guardian). The constructor calldata
|
|
1012
|
-
* `[0, public_key, 1]` for v0.4.0 and `[public_key, 0]` for v0.3.x
|
|
1011
|
+
* no guardian). The constructor calldata follows the class version:
|
|
1012
|
+
* `[0, public_key, 1]` for v0.4.0 and v0.5.0, `[public_key, 0]` for v0.3.x;
|
|
1013
|
+
* `getAccountClassRegistry()` publishes the convention next to each class.
|
|
1014
|
+
*
|
|
1015
|
+
* This is the only Argent deployment a seed phrase reproduces on its own. An
|
|
1016
|
+
* account deployed with a guardian has a different address that discovery
|
|
1017
|
+
* cannot enumerate; once its address is known, feed its `DEPLOY_ACCOUNT`
|
|
1018
|
+
* fields to `inspectAccountDeployment`, or take the guardian from that
|
|
1019
|
+
* calldata and use `deriveArgentAccountAddressWithGuardian`.
|
|
1013
1020
|
*
|
|
1014
1021
|
* # Arguments
|
|
1015
1022
|
* * `public_key` - The Stark public key (hex string)
|
|
1016
|
-
* * `class_hash` - Optional
|
|
1017
|
-
*
|
|
1018
|
-
*
|
|
1019
|
-
*
|
|
1023
|
+
* * `class_hash` - Optional class hash (hex string). Defaults to the Argent
|
|
1024
|
+
* v0.4.0 class hash. The accepted set is the Argent Cairo 1 classes:
|
|
1025
|
+
* v0.5.0, v0.4.0, v0.3.1 and v0.3.0, which are the `getAccountClassRegistry()`
|
|
1026
|
+
* entries whose constructor shape is `argent_signer_with_optional_guardian`
|
|
1027
|
+
* or `argent_owner_guardian_felts`. The Cairo 0 proxy is not accepted: its
|
|
1028
|
+
* address also depends on the implementation hash, which this export takes
|
|
1029
|
+
* no argument for, so derive it with `calculateContractAddress` and the
|
|
1030
|
+
* proxy's own calldata. Any other class hash is rejected, because its
|
|
1031
|
+
* constructor layout is unknown and an address derived for it could be
|
|
1032
|
+
* undeployable.
|
|
1020
1033
|
*
|
|
1021
1034
|
* # Returns
|
|
1022
1035
|
* The derived account contract address as hex string
|
|
1023
1036
|
*/
|
|
1024
1037
|
export function deriveArgentAccountAddress(public_key: string, class_hash?: string | null): string;
|
|
1025
1038
|
|
|
1039
|
+
/**
|
|
1040
|
+
* Derive an Argent account contract address for an owner **with** a
|
|
1041
|
+
* Starknet-key guardian.
|
|
1042
|
+
*
|
|
1043
|
+
* Salt = public key; constructor calldata `[public_key, guardian]` for
|
|
1044
|
+
* v0.3.x and `[0, public_key, 0, 0, guardian]` for v0.4.0 and v0.5.0. The
|
|
1045
|
+
* guardian is per-account and not derived from the seed, so this cannot find
|
|
1046
|
+
* accounts from a phrase. It verifies an account whose address is already
|
|
1047
|
+
* known: take the guardian from that account's `DEPLOY_ACCOUNT` calldata and
|
|
1048
|
+
* compare the result with the address. Only the deploy-time guardian fixes
|
|
1049
|
+
* the address; an account's current guardian (`get_guardian`) can have been
|
|
1050
|
+
* changed or removed since and reproduces nothing.
|
|
1051
|
+
*
|
|
1052
|
+
* # Arguments
|
|
1053
|
+
* * `public_key` - The owner's Stark public key (hex string)
|
|
1054
|
+
* * `guardian_public_key` - The guardian's Stark public key at deployment
|
|
1055
|
+
* (hex string). `"0x0"` means no guardian and gives the same address as
|
|
1056
|
+
* `deriveArgentAccountAddress`
|
|
1057
|
+
* * `class_hash` - Optional class hash, as for `deriveArgentAccountAddress`
|
|
1058
|
+
*
|
|
1059
|
+
* # Returns
|
|
1060
|
+
* The derived account contract address as hex string
|
|
1061
|
+
*/
|
|
1062
|
+
export function deriveArgentAccountAddressWithGuardian(public_key: string, guardian_public_key: string, class_hash?: string | null): string;
|
|
1063
|
+
|
|
1026
1064
|
/**
|
|
1027
1065
|
* Derive a Starknet keypair using old Argent's "double derivation" scheme.
|
|
1028
1066
|
*
|
|
@@ -1060,12 +1098,19 @@ export function deriveArgentLegacyPublicKey(mnemonic: string, address_index: num
|
|
|
1060
1098
|
/**
|
|
1061
1099
|
* Derive a Braavos account contract address from a public key.
|
|
1062
1100
|
*
|
|
1063
|
-
* Uses the
|
|
1101
|
+
* Uses the Braavos base-account deployment: salt = public key, constructor
|
|
1102
|
+
* calldata `[public_key]`. Braavos accounts are deployed with a **base**
|
|
1103
|
+
* class and upgrade themselves to an **implementation** class in the same
|
|
1104
|
+
* transaction, so the address is fixed by the base class alone and the class
|
|
1105
|
+
* an account runs today (`starknet_getClassHashAt`) never reproduces it.
|
|
1064
1106
|
*
|
|
1065
1107
|
* # Arguments
|
|
1066
1108
|
* * `public_key` - The Stark public key (hex string)
|
|
1067
|
-
* * `class_hash` - Optional
|
|
1068
|
-
*
|
|
1109
|
+
* * `class_hash` - Optional base class hash (hex string). Defaults to the
|
|
1110
|
+
* current base class (v1.1.0 and later); the v1.0.0 base class is the other
|
|
1111
|
+
* accepted value, see `getAccountClassRegistry()` (family `braavos`, role
|
|
1112
|
+
* `deployment`). A known implementation class or an unrecognised class hash
|
|
1113
|
+
* is rejected rather than deriving an address no deployment produces.
|
|
1069
1114
|
*
|
|
1070
1115
|
* # Returns
|
|
1071
1116
|
* The derived account contract address as hex string
|
|
@@ -1336,12 +1381,10 @@ export function foldStrk20ViewingKey(public_key: string, message_hash: string, r
|
|
|
1336
1381
|
*
|
|
1337
1382
|
* # Why every address, not just the first
|
|
1338
1383
|
*
|
|
1339
|
-
* A wallet type
|
|
1340
|
-
*
|
|
1341
|
-
*
|
|
1342
|
-
*
|
|
1343
|
-
* one address per wallet type silently hides deployed accounts — every
|
|
1344
|
-
* omitted variant is an account the caller cannot find.
|
|
1384
|
+
* A wallet type has several address variants at one index: two OpenZeppelin
|
|
1385
|
+
* salt policies, two Braavos base classes, four Argent Cairo 1 classes under
|
|
1386
|
+
* each key scheme, four Argent Cairo 0 implementations. This is a
|
|
1387
|
+
* funds-recovery path: collapsing to one address per type hides accounts.
|
|
1345
1388
|
*
|
|
1346
1389
|
* # Returns
|
|
1347
1390
|
* JSON string: `{ "0": { "Braavos": ["0x..."], "OpenZeppelin": ["0x...", "0x..."], ... } }`
|
|
@@ -1357,7 +1400,9 @@ export function generateAccountAddresses(mnemonic: string, max_index?: number |
|
|
|
1357
1400
|
* This is a pure cryptographic operation — no network calls are made.
|
|
1358
1401
|
* Each candidate is a possible on-chain account address. To find which
|
|
1359
1402
|
* ones are actually deployed, check each address via an RPC provider
|
|
1360
|
-
* (e.g., `provider.getClassHashAt(address)` in starknet.js).
|
|
1403
|
+
* (e.g., `provider.getClassHashAt(address)` in starknet.js). That call returns
|
|
1404
|
+
* the class the account *runs*, for Braavos always an implementation class,
|
|
1405
|
+
* never the `classHash` derived from; `getAccountClassRegistry()` labels both.
|
|
1361
1406
|
*
|
|
1362
1407
|
* # Security
|
|
1363
1408
|
*
|
|
@@ -1377,7 +1422,7 @@ export function generateAccountAddresses(mnemonic: string, max_index?: number |
|
|
|
1377
1422
|
* - `publicKey`: hex string
|
|
1378
1423
|
* - `derivationIndex`: number
|
|
1379
1424
|
* - `derivationPath`: string (e.g., "m/44'/9004'/0'/0/0")
|
|
1380
|
-
* - `classVersion`: string (e.g., "v0.4.0", "
|
|
1425
|
+
* - `classVersion`: string (e.g., "v0.4.0", "base v1.1.0")
|
|
1381
1426
|
*
|
|
1382
1427
|
* # Example (JavaScript)
|
|
1383
1428
|
* ```javascript
|
|
@@ -1443,14 +1488,80 @@ export function generateWithdrawProof(account: WasmAccount, params: WasmWithdraw
|
|
|
1443
1488
|
/**
|
|
1444
1489
|
* Get known account class hashes for common Starknet account implementations.
|
|
1445
1490
|
*
|
|
1446
|
-
*
|
|
1447
|
-
*
|
|
1491
|
+
* A flat map of class hashes by family and version label. It does not say
|
|
1492
|
+
* which role a class plays, and that distinction matters: an address is fixed
|
|
1493
|
+
* by the class an account was **deployed** with, while the class it **runs**
|
|
1494
|
+
* today (what a signer must accept) is a different one for every Braavos
|
|
1495
|
+
* account. Prefer `getAccountClassRegistry()`, which labels every entry by
|
|
1496
|
+
* role; this export is kept for callers that rely on its shape.
|
|
1497
|
+
*
|
|
1498
|
+
* Braavos keys: `"1.0.0"` is the historical name of the base (deployment)
|
|
1499
|
+
* class introduced in v1.1.0 and still current; `"base-1.0.0"` is the v1.0.0
|
|
1500
|
+
* base class; `"legacy"` is the v1.0.0 account implementation and
|
|
1501
|
+
* `"account-1.1.0"` / `"account-1.2.0"` the later ones. Only the two base
|
|
1502
|
+
* classes derive addresses.
|
|
1448
1503
|
*
|
|
1449
1504
|
* # Returns
|
|
1450
|
-
* JSON string with nested object:
|
|
1505
|
+
* JSON string with nested object:
|
|
1506
|
+
* `{ oz: { ... }, argent: { ... }, argent_legacy: { ... }, braavos: { ... } }`
|
|
1451
1507
|
*/
|
|
1452
1508
|
export function getAccountClassHashes(): string;
|
|
1453
1509
|
|
|
1510
|
+
/**
|
|
1511
|
+
* Every account class this crate knows, labelled by the role it plays.
|
|
1512
|
+
*
|
|
1513
|
+
* A class hash plays one of two roles, and a wallet needs both lists:
|
|
1514
|
+
*
|
|
1515
|
+
* - `deployment`: the class an account is deployed with. It fixes the
|
|
1516
|
+
* address, so it is the class to **derive from** when looking for an
|
|
1517
|
+
* account from a seed.
|
|
1518
|
+
* - `implementation`: a class an account's address can report on chain
|
|
1519
|
+
* (`starknet_getClassHashAt`) and what to **accept when signing**. An entry
|
|
1520
|
+
* may also have the `deployment` role; only implementation-only entries
|
|
1521
|
+
* must not be used for address derivation.
|
|
1522
|
+
* - `proxy_target`: the class a proxy delegates to, named in the proxy's
|
|
1523
|
+
* constructor calldata. It is code the account runs, but no address ever
|
|
1524
|
+
* reports it, so a signing allowlist must not expect it. These are the
|
|
1525
|
+
* values the Argent Cairo 0 proxy's `implementation` input takes.
|
|
1526
|
+
*
|
|
1527
|
+
* Braavos accounts are deployed with a base class and upgraded to an
|
|
1528
|
+
* implementation class in the same transaction, so every Braavos account
|
|
1529
|
+
* runs a different class than it was deployed with. Argent and OpenZeppelin
|
|
1530
|
+
* classes play both roles, including the Argent Cairo 0 proxy: an unupgraded
|
|
1531
|
+
* Cairo 0 account reports the proxy's class hash, not its target's.
|
|
1532
|
+
*
|
|
1533
|
+
* # Returns
|
|
1534
|
+
* JSON string: array of objects with fields:
|
|
1535
|
+
* - `family`: "open_zeppelin" | "argent" | "braavos"
|
|
1536
|
+
* - `classHash`: hex string
|
|
1537
|
+
* - `version`: vendor release label (e.g. "1.2.0", "0.4.0", "proxy")
|
|
1538
|
+
* - `label`: human-readable name
|
|
1539
|
+
* - `roles`: array of "deployment" | "implementation" | "proxy_target"
|
|
1540
|
+
* - `constructor`: the class's calldata convention, or `null` for a class
|
|
1541
|
+
* that is never deployed with. An object with `shape` ("public_key" |
|
|
1542
|
+
* "argent_owner_guardian_felts" | "argent_signer_with_optional_guardian" |
|
|
1543
|
+
* "argent_cairo0_proxy"), `fromSeed` (the calldata a seed reproduces, e.g.
|
|
1544
|
+
* `"[0, owner, 1]"`), `withGuardian` (the calldata once a guardian is set,
|
|
1545
|
+
* e.g. `"[0, owner, 0, 0, guardian]"`, or `null`) and `inputsOutsideSeed`
|
|
1546
|
+
* (constructor inputs a phrase cannot supply, e.g. `["guardian"]`). The
|
|
1547
|
+
* convention varies by version and by guardian presence and cannot be
|
|
1548
|
+
* inferred from the class hash, which is why it travels with the class.
|
|
1549
|
+
* An `implementation` placeholder takes its values from this registry's
|
|
1550
|
+
* `proxy_target` entries for the same family, so a template can be
|
|
1551
|
+
* rendered from the registry alone.
|
|
1552
|
+
* - `source`: URL of the public listing the entry was checked against
|
|
1553
|
+
*
|
|
1554
|
+
* # Example (JavaScript)
|
|
1555
|
+
* ```javascript
|
|
1556
|
+
* const registry = JSON.parse(getAccountClassRegistry());
|
|
1557
|
+
* const deriveFrom = registry.filter(c => c.family === "braavos" && c.roles.includes("deployment"));
|
|
1558
|
+
* const acceptWhenSigning = registry.filter(c => c.family === "braavos" && c.roles.includes("implementation"));
|
|
1559
|
+
* // Values the Argent Cairo 0 proxy's `implementation` input takes:
|
|
1560
|
+
* const proxyTargets = registry.filter(c => c.family === "argent" && c.roles.includes("proxy_target"));
|
|
1561
|
+
* ```
|
|
1562
|
+
*/
|
|
1563
|
+
export function getAccountClassRegistry(): string;
|
|
1564
|
+
|
|
1454
1565
|
/**
|
|
1455
1566
|
* Get build information.
|
|
1456
1567
|
*/
|
|
@@ -1513,6 +1624,47 @@ export function grindKey(seed_hex: string): string;
|
|
|
1513
1624
|
*/
|
|
1514
1625
|
export function init(): void;
|
|
1515
1626
|
|
|
1627
|
+
/**
|
|
1628
|
+
* State whether an account deployment can be found from a seed phrase.
|
|
1629
|
+
*
|
|
1630
|
+
* Takes the three `DEPLOY_ACCOUNT` fields that fix an address. An account
|
|
1631
|
+
* that exists but whose address depends on inputs outside the seed (an
|
|
1632
|
+
* Argent guardian, a non-Starknet owner, a server-assigned salt) is
|
|
1633
|
+
* reported as `not_from_seed` with the reason, so a recovery flow can tell
|
|
1634
|
+
* "not discoverable from a phrase" apart from "no such account". Such an
|
|
1635
|
+
* account is still verifiable: check that `address` is the account's and
|
|
1636
|
+
* that `ownerPublicKey` is one of the seed's derived keys. `guardianPublicKey`
|
|
1637
|
+
* is the deploy-time guardian, which is the one that fixes the address; an
|
|
1638
|
+
* account's current guardian can have changed since.
|
|
1639
|
+
*
|
|
1640
|
+
* Pass the class hash from the deploy transaction, not the class the account
|
|
1641
|
+
* runs today: for an upgraded account the current class is an implementation
|
|
1642
|
+
* class and the answer is `not_from_seed` / `implementation_class`.
|
|
1643
|
+
*
|
|
1644
|
+
* # Arguments
|
|
1645
|
+
* * `class_hash` - `DEPLOY_ACCOUNT.class_hash` (hex string)
|
|
1646
|
+
* * `salt` - `DEPLOY_ACCOUNT.contract_address_salt` (hex string)
|
|
1647
|
+
* * `constructor_calldata` - `DEPLOY_ACCOUNT.constructor_calldata` (hex strings)
|
|
1648
|
+
*
|
|
1649
|
+
* # Returns
|
|
1650
|
+
* JSON string with fields:
|
|
1651
|
+
* - `address`: the address these fields fix (deployer zero). Compare it with
|
|
1652
|
+
* the account being checked before trusting anything else in the result:
|
|
1653
|
+
* the fields are usually an RPC response, and fields that do not hash to
|
|
1654
|
+
* the account say nothing about it
|
|
1655
|
+
* - `known`: whether the class hash is in the registry
|
|
1656
|
+
* - `class`: the registry entry (see `getAccountClassRegistry`), or `null`
|
|
1657
|
+
* - `ownerPublicKey`: the Stark key the constructor binds as owner, or `null`
|
|
1658
|
+
* - `guardianPublicKey`: the guardian's Stark key when a Starknet-key
|
|
1659
|
+
* guardian is set, or `null`
|
|
1660
|
+
* - `derivability`: "from_seed" | "not_from_seed" | "unknown_class"
|
|
1661
|
+
* - `reason`: for `not_from_seed`, one of "guardian" | "non_starknet_owner" |
|
|
1662
|
+
* "salt_not_public_key" | "implementation_class" | "proxy_target_class" |
|
|
1663
|
+
* "unknown_proxy_implementation" | "unexpected_constructor_calldata";
|
|
1664
|
+
* otherwise `null`
|
|
1665
|
+
*/
|
|
1666
|
+
export function inspectAccountDeployment(class_hash: string, salt: string, constructor_calldata: string[]): string;
|
|
1667
|
+
|
|
1516
1668
|
/**
|
|
1517
1669
|
* Check whether a hex string is a valid Stark field element.
|
|
1518
1670
|
*
|
|
@@ -2077,17 +2229,24 @@ export interface InitOutput {
|
|
|
2077
2229
|
readonly __wbg_set_wasmstarkxonlykeypair_private_key: (a: number, b: number, c: number) => void;
|
|
2078
2230
|
readonly __wbg_set_wasmstarkxonlykeypair_public_key_x: (a: number, b: number, c: number) => void;
|
|
2079
2231
|
readonly __wbg_set_wasmstarkxonlypublickey_public_key_x: (a: number, b: number, c: number) => void;
|
|
2232
|
+
readonly __wbg_get_wasmencryptedkey_encryptedKey: (a: number) => [number, number];
|
|
2233
|
+
readonly __wbg_get_wasmencryptedkey_nonce: (a: number) => [number, number];
|
|
2234
|
+
readonly __wbg_get_wasmencryptedkey_salt: (a: number) => [number, number];
|
|
2235
|
+
readonly __wbg_set_wasmencryptedkey_encryptedKey: (a: number, b: number, c: number) => void;
|
|
2236
|
+
readonly __wbg_set_wasmencryptedkey_nonce: (a: number, b: number, c: number) => void;
|
|
2237
|
+
readonly __wbg_set_wasmencryptedkey_salt: (a: number, b: number, c: number) => void;
|
|
2238
|
+
readonly __wbg_wasmaccount_free: (a: number, b: number) => void;
|
|
2239
|
+
readonly __wbg_wasmencryptedkey_free: (a: number, b: number) => void;
|
|
2240
|
+
readonly __wbg_wasmencryptedpayload_free: (a: number, b: number) => void;
|
|
2241
|
+
readonly decryptEthersKeystore: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2242
|
+
readonly decryptKeystore: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2243
|
+
readonly decryptPrivateKey: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
|
|
2244
|
+
readonly decryptWithKey: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
2080
2245
|
readonly deriveNostrKeypair: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
2081
2246
|
readonly deriveNostrPublicKey: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
2082
|
-
readonly
|
|
2083
|
-
readonly
|
|
2084
|
-
readonly
|
|
2085
|
-
readonly foldStrk20ViewingKey: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
2086
|
-
readonly getSelectorFromName: (a: number, b: number) => [number, number, number, number];
|
|
2087
|
-
readonly pedersenHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2088
|
-
readonly pedersenHashMany: (a: number, b: number) => [number, number, number, number];
|
|
2089
|
-
readonly starknetKeccak: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2090
|
-
readonly strk20ViewingKeyMessageHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2247
|
+
readonly encryptKeystore: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
2248
|
+
readonly encryptPrivateKey: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
2249
|
+
readonly encryptWithKey: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
2091
2250
|
readonly wasmaccount_contractAddress: (a: number) => [number, number];
|
|
2092
2251
|
readonly wasmaccount_decryptBalance: (a: number, b: number, c: number, d: bigint) => [number, number, number, number];
|
|
2093
2252
|
readonly wasmaccount_decryptToPoint: (a: number, b: number) => [number, number, number];
|
|
@@ -2098,15 +2257,23 @@ export interface InitOutput {
|
|
|
2098
2257
|
readonly wasmaccount_ownerPublicKeyHex: (a: number) => [number, number, number, number];
|
|
2099
2258
|
readonly wasmaccount_totalBalance: (a: number) => [number, number, number, number];
|
|
2100
2259
|
readonly wasmaccount_updateState: (a: number, b: number) => [number, number];
|
|
2260
|
+
readonly __wbg_get_wasmencryptedpayload_ciphertext: (a: number) => [number, number];
|
|
2261
|
+
readonly __wbg_get_wasmencryptedpayload_nonce: (a: number) => [number, number];
|
|
2262
|
+
readonly __wbg_set_wasmencryptedpayload_ciphertext: (a: number, b: number, c: number) => void;
|
|
2263
|
+
readonly __wbg_set_wasmencryptedpayload_nonce: (a: number, b: number, c: number) => void;
|
|
2101
2264
|
readonly deserializePublicKey: (a: number, b: number) => [number, number, number];
|
|
2102
2265
|
readonly getBuildInfo: () => any;
|
|
2103
2266
|
readonly getGenerator: () => number;
|
|
2104
2267
|
readonly getVersion: () => [number, number];
|
|
2268
|
+
readonly grindKey: (a: number, b: number) => [number, number, number, number];
|
|
2105
2269
|
readonly init: () => void;
|
|
2270
|
+
readonly isValidFelt: (a: number, b: number) => number;
|
|
2271
|
+
readonly isValidStarkPrivateKey: (a: number, b: number) => number;
|
|
2106
2272
|
readonly nostrPublicKey: (a: number, b: number) => [number, number, number, number];
|
|
2107
2273
|
readonly pointAdd: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
|
|
2108
2274
|
readonly poseidonHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2109
2275
|
readonly poseidonHashMany: (a: number, b: number) => [number, number, number, number];
|
|
2276
|
+
readonly randomBytesHex: (a: number) => [number, number, number, number];
|
|
2110
2277
|
readonly randomFelt: () => [number, number];
|
|
2111
2278
|
readonly scalarMul: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
2112
2279
|
readonly scalarMulGenerator: (a: number, b: number) => [number, number, number];
|
|
@@ -2115,13 +2282,10 @@ export interface InitOutput {
|
|
|
2115
2282
|
readonly signNostrMessage: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
2116
2283
|
readonly signStarkHash: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
2117
2284
|
readonly starkPublicKey: (a: number, b: number) => [number, number, number, number];
|
|
2118
|
-
readonly
|
|
2119
|
-
readonly
|
|
2120
|
-
readonly
|
|
2121
|
-
readonly
|
|
2122
|
-
readonly getAccountClassHashes: () => [number, number];
|
|
2123
|
-
readonly openNostrApplicationData: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
2124
|
-
readonly wrapNostrApplicationData: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number];
|
|
2285
|
+
readonly compileCalls: (a: number, b: number) => [number, number, number, number];
|
|
2286
|
+
readonly decodeShortString: (a: number, b: number) => [number, number, number, number];
|
|
2287
|
+
readonly encodeFelt: (a: number, b: number) => [number, number, number, number];
|
|
2288
|
+
readonly encodeShortString: (a: number, b: number) => [number, number, number, number];
|
|
2125
2289
|
readonly deriveArgentLegacyKeypair: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
2126
2290
|
readonly deriveArgentLegacyPublicKey: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
2127
2291
|
readonly deriveDiscoveryKeypairs: (a: number, b: number, c: number) => [number, number, number, number];
|
|
@@ -2140,6 +2304,18 @@ export interface InitOutput {
|
|
|
2140
2304
|
readonly getStarknetCoinType: () => number;
|
|
2141
2305
|
readonly getTongoCoinType: () => number;
|
|
2142
2306
|
readonly validateMnemonic: (a: number, b: number) => number;
|
|
2307
|
+
readonly calculateContractAddress: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
2308
|
+
readonly deriveArgentAccountAddress: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2309
|
+
readonly deriveArgentAccountAddressWithGuardian: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
2310
|
+
readonly deriveBraavosAccountAddress: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2311
|
+
readonly deriveOzAccountAddress: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
2312
|
+
readonly deriveScopedStrk20ViewingKey: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
2313
|
+
readonly deriveStrk20ViewingKey: (a: number, b: number) => [number, number, number, number];
|
|
2314
|
+
readonly foldStrk20ViewingKey: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
2315
|
+
readonly getAccountClassHashes: () => [number, number];
|
|
2316
|
+
readonly openNostrApplicationData: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
2317
|
+
readonly strk20ViewingKeyMessageHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2318
|
+
readonly wrapNostrApplicationData: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number];
|
|
2143
2319
|
readonly computeDeclareTransactionHashV2: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number, number, number];
|
|
2144
2320
|
readonly computeDeclareTransactionHashV3: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: any, n: number, o: number, p: number, q: number, r: number, s: number) => [number, number, number, number];
|
|
2145
2321
|
readonly computeDeployAccountTransactionHashV1: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => [number, number, number, number];
|
|
@@ -2147,33 +2323,12 @@ export interface InitOutput {
|
|
|
2147
2323
|
readonly computeInvokeTransactionHashV1: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number, number, number];
|
|
2148
2324
|
readonly computeInvokeTransactionHashV3: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: any, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number) => [number, number, number, number];
|
|
2149
2325
|
readonly computeTypedDataMessageHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2150
|
-
readonly
|
|
2151
|
-
readonly
|
|
2152
|
-
readonly
|
|
2153
|
-
readonly
|
|
2154
|
-
readonly
|
|
2155
|
-
readonly
|
|
2156
|
-
readonly __wbg_wasmencryptedkey_free: (a: number, b: number) => void;
|
|
2157
|
-
readonly __wbg_wasmencryptedpayload_free: (a: number, b: number) => void;
|
|
2158
|
-
readonly decryptEthersKeystore: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2159
|
-
readonly decryptKeystore: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2160
|
-
readonly decryptPrivateKey: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number, number, number];
|
|
2161
|
-
readonly decryptWithKey: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
2162
|
-
readonly encryptKeystore: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
2163
|
-
readonly encryptPrivateKey: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
2164
|
-
readonly encryptWithKey: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
2165
|
-
readonly grindKey: (a: number, b: number) => [number, number, number, number];
|
|
2166
|
-
readonly isValidFelt: (a: number, b: number) => number;
|
|
2167
|
-
readonly isValidStarkPrivateKey: (a: number, b: number) => number;
|
|
2168
|
-
readonly randomBytesHex: (a: number) => [number, number, number, number];
|
|
2169
|
-
readonly __wbg_get_wasmencryptedpayload_ciphertext: (a: number) => [number, number];
|
|
2170
|
-
readonly __wbg_get_wasmencryptedpayload_nonce: (a: number) => [number, number];
|
|
2171
|
-
readonly __wbg_set_wasmencryptedpayload_ciphertext: (a: number, b: number, c: number) => void;
|
|
2172
|
-
readonly __wbg_set_wasmencryptedpayload_nonce: (a: number, b: number, c: number) => void;
|
|
2173
|
-
readonly compileCalls: (a: number, b: number) => [number, number, number, number];
|
|
2174
|
-
readonly decodeShortString: (a: number, b: number) => [number, number, number, number];
|
|
2175
|
-
readonly encodeFelt: (a: number, b: number) => [number, number, number, number];
|
|
2176
|
-
readonly encodeShortString: (a: number, b: number) => [number, number, number, number];
|
|
2326
|
+
readonly getSelectorFromName: (a: number, b: number) => [number, number, number, number];
|
|
2327
|
+
readonly pedersenHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2328
|
+
readonly pedersenHashMany: (a: number, b: number) => [number, number, number, number];
|
|
2329
|
+
readonly starknetKeccak: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2330
|
+
readonly getAccountClassRegistry: () => [number, number, number, number];
|
|
2331
|
+
readonly inspectAccountDeployment: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
|
|
2177
2332
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
2178
2333
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
2179
2334
|
readonly __wbindgen_exn_store: (a: number) => void;
|
package/krusty_kms_wasm.js
CHANGED
|
@@ -5344,15 +5344,28 @@ export function decryptWithKey(nonce, ciphertext, key_hex) {
|
|
|
5344
5344
|
* Derive an Argent account contract address from a public key.
|
|
5345
5345
|
*
|
|
5346
5346
|
* Uses the standard Argent deployment (salt = public key, Starknet-key owner,
|
|
5347
|
-
* no guardian). The constructor calldata
|
|
5348
|
-
* `[0, public_key, 1]` for v0.4.0 and `[public_key, 0]` for v0.3.x
|
|
5347
|
+
* no guardian). The constructor calldata follows the class version:
|
|
5348
|
+
* `[0, public_key, 1]` for v0.4.0 and v0.5.0, `[public_key, 0]` for v0.3.x;
|
|
5349
|
+
* `getAccountClassRegistry()` publishes the convention next to each class.
|
|
5350
|
+
*
|
|
5351
|
+
* This is the only Argent deployment a seed phrase reproduces on its own. An
|
|
5352
|
+
* account deployed with a guardian has a different address that discovery
|
|
5353
|
+
* cannot enumerate; once its address is known, feed its `DEPLOY_ACCOUNT`
|
|
5354
|
+
* fields to `inspectAccountDeployment`, or take the guardian from that
|
|
5355
|
+
* calldata and use `deriveArgentAccountAddressWithGuardian`.
|
|
5349
5356
|
*
|
|
5350
5357
|
* # Arguments
|
|
5351
5358
|
* * `public_key` - The Stark public key (hex string)
|
|
5352
|
-
* * `class_hash` - Optional
|
|
5353
|
-
*
|
|
5354
|
-
*
|
|
5355
|
-
*
|
|
5359
|
+
* * `class_hash` - Optional class hash (hex string). Defaults to the Argent
|
|
5360
|
+
* v0.4.0 class hash. The accepted set is the Argent Cairo 1 classes:
|
|
5361
|
+
* v0.5.0, v0.4.0, v0.3.1 and v0.3.0, which are the `getAccountClassRegistry()`
|
|
5362
|
+
* entries whose constructor shape is `argent_signer_with_optional_guardian`
|
|
5363
|
+
* or `argent_owner_guardian_felts`. The Cairo 0 proxy is not accepted: its
|
|
5364
|
+
* address also depends on the implementation hash, which this export takes
|
|
5365
|
+
* no argument for, so derive it with `calculateContractAddress` and the
|
|
5366
|
+
* proxy's own calldata. Any other class hash is rejected, because its
|
|
5367
|
+
* constructor layout is unknown and an address derived for it could be
|
|
5368
|
+
* undeployable.
|
|
5356
5369
|
*
|
|
5357
5370
|
* # Returns
|
|
5358
5371
|
* The derived account contract address as hex string
|
|
@@ -5383,6 +5396,58 @@ export function deriveArgentAccountAddress(public_key, class_hash) {
|
|
|
5383
5396
|
}
|
|
5384
5397
|
}
|
|
5385
5398
|
|
|
5399
|
+
/**
|
|
5400
|
+
* Derive an Argent account contract address for an owner **with** a
|
|
5401
|
+
* Starknet-key guardian.
|
|
5402
|
+
*
|
|
5403
|
+
* Salt = public key; constructor calldata `[public_key, guardian]` for
|
|
5404
|
+
* v0.3.x and `[0, public_key, 0, 0, guardian]` for v0.4.0 and v0.5.0. The
|
|
5405
|
+
* guardian is per-account and not derived from the seed, so this cannot find
|
|
5406
|
+
* accounts from a phrase. It verifies an account whose address is already
|
|
5407
|
+
* known: take the guardian from that account's `DEPLOY_ACCOUNT` calldata and
|
|
5408
|
+
* compare the result with the address. Only the deploy-time guardian fixes
|
|
5409
|
+
* the address; an account's current guardian (`get_guardian`) can have been
|
|
5410
|
+
* changed or removed since and reproduces nothing.
|
|
5411
|
+
*
|
|
5412
|
+
* # Arguments
|
|
5413
|
+
* * `public_key` - The owner's Stark public key (hex string)
|
|
5414
|
+
* * `guardian_public_key` - The guardian's Stark public key at deployment
|
|
5415
|
+
* (hex string). `"0x0"` means no guardian and gives the same address as
|
|
5416
|
+
* `deriveArgentAccountAddress`
|
|
5417
|
+
* * `class_hash` - Optional class hash, as for `deriveArgentAccountAddress`
|
|
5418
|
+
*
|
|
5419
|
+
* # Returns
|
|
5420
|
+
* The derived account contract address as hex string
|
|
5421
|
+
* @param {string} public_key
|
|
5422
|
+
* @param {string} guardian_public_key
|
|
5423
|
+
* @param {string | null} [class_hash]
|
|
5424
|
+
* @returns {string}
|
|
5425
|
+
*/
|
|
5426
|
+
export function deriveArgentAccountAddressWithGuardian(public_key, guardian_public_key, class_hash) {
|
|
5427
|
+
let deferred5_0;
|
|
5428
|
+
let deferred5_1;
|
|
5429
|
+
try {
|
|
5430
|
+
const ptr0 = passStringToWasm0(public_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5431
|
+
const len0 = WASM_VECTOR_LEN;
|
|
5432
|
+
const ptr1 = passStringToWasm0(guardian_public_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5433
|
+
const len1 = WASM_VECTOR_LEN;
|
|
5434
|
+
var ptr2 = isLikeNone(class_hash) ? 0 : passStringToWasm0(class_hash, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5435
|
+
var len2 = WASM_VECTOR_LEN;
|
|
5436
|
+
const ret = wasm.deriveArgentAccountAddressWithGuardian(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
5437
|
+
var ptr4 = ret[0];
|
|
5438
|
+
var len4 = ret[1];
|
|
5439
|
+
if (ret[3]) {
|
|
5440
|
+
ptr4 = 0; len4 = 0;
|
|
5441
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
5442
|
+
}
|
|
5443
|
+
deferred5_0 = ptr4;
|
|
5444
|
+
deferred5_1 = len4;
|
|
5445
|
+
return getStringFromWasm0(ptr4, len4);
|
|
5446
|
+
} finally {
|
|
5447
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
5448
|
+
}
|
|
5449
|
+
}
|
|
5450
|
+
|
|
5386
5451
|
/**
|
|
5387
5452
|
* Derive a Starknet keypair using old Argent's "double derivation" scheme.
|
|
5388
5453
|
*
|
|
@@ -5444,12 +5509,19 @@ export function deriveArgentLegacyPublicKey(mnemonic, address_index, account_ind
|
|
|
5444
5509
|
/**
|
|
5445
5510
|
* Derive a Braavos account contract address from a public key.
|
|
5446
5511
|
*
|
|
5447
|
-
* Uses the
|
|
5512
|
+
* Uses the Braavos base-account deployment: salt = public key, constructor
|
|
5513
|
+
* calldata `[public_key]`. Braavos accounts are deployed with a **base**
|
|
5514
|
+
* class and upgrade themselves to an **implementation** class in the same
|
|
5515
|
+
* transaction, so the address is fixed by the base class alone and the class
|
|
5516
|
+
* an account runs today (`starknet_getClassHashAt`) never reproduces it.
|
|
5448
5517
|
*
|
|
5449
5518
|
* # Arguments
|
|
5450
5519
|
* * `public_key` - The Stark public key (hex string)
|
|
5451
|
-
* * `class_hash` - Optional
|
|
5452
|
-
*
|
|
5520
|
+
* * `class_hash` - Optional base class hash (hex string). Defaults to the
|
|
5521
|
+
* current base class (v1.1.0 and later); the v1.0.0 base class is the other
|
|
5522
|
+
* accepted value, see `getAccountClassRegistry()` (family `braavos`, role
|
|
5523
|
+
* `deployment`). A known implementation class or an unrecognised class hash
|
|
5524
|
+
* is rejected rather than deriving an address no deployment produces.
|
|
5453
5525
|
*
|
|
5454
5526
|
* # Returns
|
|
5455
5527
|
* The derived account contract address as hex string
|
|
@@ -6131,12 +6203,10 @@ export function foldStrk20ViewingKey(public_key, message_hash, r, s) {
|
|
|
6131
6203
|
*
|
|
6132
6204
|
* # Why every address, not just the first
|
|
6133
6205
|
*
|
|
6134
|
-
* A wallet type
|
|
6135
|
-
*
|
|
6136
|
-
*
|
|
6137
|
-
*
|
|
6138
|
-
* one address per wallet type silently hides deployed accounts — every
|
|
6139
|
-
* omitted variant is an account the caller cannot find.
|
|
6206
|
+
* A wallet type has several address variants at one index: two OpenZeppelin
|
|
6207
|
+
* salt policies, two Braavos base classes, four Argent Cairo 1 classes under
|
|
6208
|
+
* each key scheme, four Argent Cairo 0 implementations. This is a
|
|
6209
|
+
* funds-recovery path: collapsing to one address per type hides accounts.
|
|
6140
6210
|
*
|
|
6141
6211
|
* # Returns
|
|
6142
6212
|
* JSON string: `{ "0": { "Braavos": ["0x..."], "OpenZeppelin": ["0x...", "0x..."], ... } }`
|
|
@@ -6174,7 +6244,9 @@ export function generateAccountAddresses(mnemonic, max_index) {
|
|
|
6174
6244
|
* This is a pure cryptographic operation — no network calls are made.
|
|
6175
6245
|
* Each candidate is a possible on-chain account address. To find which
|
|
6176
6246
|
* ones are actually deployed, check each address via an RPC provider
|
|
6177
|
-
* (e.g., `provider.getClassHashAt(address)` in starknet.js).
|
|
6247
|
+
* (e.g., `provider.getClassHashAt(address)` in starknet.js). That call returns
|
|
6248
|
+
* the class the account *runs*, for Braavos always an implementation class,
|
|
6249
|
+
* never the `classHash` derived from; `getAccountClassRegistry()` labels both.
|
|
6178
6250
|
*
|
|
6179
6251
|
* # Security
|
|
6180
6252
|
*
|
|
@@ -6194,7 +6266,7 @@ export function generateAccountAddresses(mnemonic, max_index) {
|
|
|
6194
6266
|
* - `publicKey`: hex string
|
|
6195
6267
|
* - `derivationIndex`: number
|
|
6196
6268
|
* - `derivationPath`: string (e.g., "m/44'/9004'/0'/0/0")
|
|
6197
|
-
* - `classVersion`: string (e.g., "v0.4.0", "
|
|
6269
|
+
* - `classVersion`: string (e.g., "v0.4.0", "base v1.1.0")
|
|
6198
6270
|
*
|
|
6199
6271
|
* # Example (JavaScript)
|
|
6200
6272
|
* ```javascript
|
|
@@ -6378,11 +6450,22 @@ export function generateWithdrawProof(account, params) {
|
|
|
6378
6450
|
/**
|
|
6379
6451
|
* Get known account class hashes for common Starknet account implementations.
|
|
6380
6452
|
*
|
|
6381
|
-
*
|
|
6382
|
-
*
|
|
6453
|
+
* A flat map of class hashes by family and version label. It does not say
|
|
6454
|
+
* which role a class plays, and that distinction matters: an address is fixed
|
|
6455
|
+
* by the class an account was **deployed** with, while the class it **runs**
|
|
6456
|
+
* today (what a signer must accept) is a different one for every Braavos
|
|
6457
|
+
* account. Prefer `getAccountClassRegistry()`, which labels every entry by
|
|
6458
|
+
* role; this export is kept for callers that rely on its shape.
|
|
6459
|
+
*
|
|
6460
|
+
* Braavos keys: `"1.0.0"` is the historical name of the base (deployment)
|
|
6461
|
+
* class introduced in v1.1.0 and still current; `"base-1.0.0"` is the v1.0.0
|
|
6462
|
+
* base class; `"legacy"` is the v1.0.0 account implementation and
|
|
6463
|
+
* `"account-1.1.0"` / `"account-1.2.0"` the later ones. Only the two base
|
|
6464
|
+
* classes derive addresses.
|
|
6383
6465
|
*
|
|
6384
6466
|
* # Returns
|
|
6385
|
-
* JSON string with nested object:
|
|
6467
|
+
* JSON string with nested object:
|
|
6468
|
+
* `{ oz: { ... }, argent: { ... }, argent_legacy: { ... }, braavos: { ... } }`
|
|
6386
6469
|
* @returns {string}
|
|
6387
6470
|
*/
|
|
6388
6471
|
export function getAccountClassHashes() {
|
|
@@ -6398,6 +6481,79 @@ export function getAccountClassHashes() {
|
|
|
6398
6481
|
}
|
|
6399
6482
|
}
|
|
6400
6483
|
|
|
6484
|
+
/**
|
|
6485
|
+
* Every account class this crate knows, labelled by the role it plays.
|
|
6486
|
+
*
|
|
6487
|
+
* A class hash plays one of two roles, and a wallet needs both lists:
|
|
6488
|
+
*
|
|
6489
|
+
* - `deployment`: the class an account is deployed with. It fixes the
|
|
6490
|
+
* address, so it is the class to **derive from** when looking for an
|
|
6491
|
+
* account from a seed.
|
|
6492
|
+
* - `implementation`: a class an account's address can report on chain
|
|
6493
|
+
* (`starknet_getClassHashAt`) and what to **accept when signing**. An entry
|
|
6494
|
+
* may also have the `deployment` role; only implementation-only entries
|
|
6495
|
+
* must not be used for address derivation.
|
|
6496
|
+
* - `proxy_target`: the class a proxy delegates to, named in the proxy's
|
|
6497
|
+
* constructor calldata. It is code the account runs, but no address ever
|
|
6498
|
+
* reports it, so a signing allowlist must not expect it. These are the
|
|
6499
|
+
* values the Argent Cairo 0 proxy's `implementation` input takes.
|
|
6500
|
+
*
|
|
6501
|
+
* Braavos accounts are deployed with a base class and upgraded to an
|
|
6502
|
+
* implementation class in the same transaction, so every Braavos account
|
|
6503
|
+
* runs a different class than it was deployed with. Argent and OpenZeppelin
|
|
6504
|
+
* classes play both roles, including the Argent Cairo 0 proxy: an unupgraded
|
|
6505
|
+
* Cairo 0 account reports the proxy's class hash, not its target's.
|
|
6506
|
+
*
|
|
6507
|
+
* # Returns
|
|
6508
|
+
* JSON string: array of objects with fields:
|
|
6509
|
+
* - `family`: "open_zeppelin" | "argent" | "braavos"
|
|
6510
|
+
* - `classHash`: hex string
|
|
6511
|
+
* - `version`: vendor release label (e.g. "1.2.0", "0.4.0", "proxy")
|
|
6512
|
+
* - `label`: human-readable name
|
|
6513
|
+
* - `roles`: array of "deployment" | "implementation" | "proxy_target"
|
|
6514
|
+
* - `constructor`: the class's calldata convention, or `null` for a class
|
|
6515
|
+
* that is never deployed with. An object with `shape` ("public_key" |
|
|
6516
|
+
* "argent_owner_guardian_felts" | "argent_signer_with_optional_guardian" |
|
|
6517
|
+
* "argent_cairo0_proxy"), `fromSeed` (the calldata a seed reproduces, e.g.
|
|
6518
|
+
* `"[0, owner, 1]"`), `withGuardian` (the calldata once a guardian is set,
|
|
6519
|
+
* e.g. `"[0, owner, 0, 0, guardian]"`, or `null`) and `inputsOutsideSeed`
|
|
6520
|
+
* (constructor inputs a phrase cannot supply, e.g. `["guardian"]`). The
|
|
6521
|
+
* convention varies by version and by guardian presence and cannot be
|
|
6522
|
+
* inferred from the class hash, which is why it travels with the class.
|
|
6523
|
+
* An `implementation` placeholder takes its values from this registry's
|
|
6524
|
+
* `proxy_target` entries for the same family, so a template can be
|
|
6525
|
+
* rendered from the registry alone.
|
|
6526
|
+
* - `source`: URL of the public listing the entry was checked against
|
|
6527
|
+
*
|
|
6528
|
+
* # Example (JavaScript)
|
|
6529
|
+
* ```javascript
|
|
6530
|
+
* const registry = JSON.parse(getAccountClassRegistry());
|
|
6531
|
+
* const deriveFrom = registry.filter(c => c.family === "braavos" && c.roles.includes("deployment"));
|
|
6532
|
+
* const acceptWhenSigning = registry.filter(c => c.family === "braavos" && c.roles.includes("implementation"));
|
|
6533
|
+
* // Values the Argent Cairo 0 proxy's `implementation` input takes:
|
|
6534
|
+
* const proxyTargets = registry.filter(c => c.family === "argent" && c.roles.includes("proxy_target"));
|
|
6535
|
+
* ```
|
|
6536
|
+
* @returns {string}
|
|
6537
|
+
*/
|
|
6538
|
+
export function getAccountClassRegistry() {
|
|
6539
|
+
let deferred2_0;
|
|
6540
|
+
let deferred2_1;
|
|
6541
|
+
try {
|
|
6542
|
+
const ret = wasm.getAccountClassRegistry();
|
|
6543
|
+
var ptr1 = ret[0];
|
|
6544
|
+
var len1 = ret[1];
|
|
6545
|
+
if (ret[3]) {
|
|
6546
|
+
ptr1 = 0; len1 = 0;
|
|
6547
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
6548
|
+
}
|
|
6549
|
+
deferred2_0 = ptr1;
|
|
6550
|
+
deferred2_1 = len1;
|
|
6551
|
+
return getStringFromWasm0(ptr1, len1);
|
|
6552
|
+
} finally {
|
|
6553
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
6554
|
+
}
|
|
6555
|
+
}
|
|
6556
|
+
|
|
6401
6557
|
/**
|
|
6402
6558
|
* Get build information.
|
|
6403
6559
|
* @returns {any}
|
|
@@ -6536,6 +6692,74 @@ export function init() {
|
|
|
6536
6692
|
wasm.init();
|
|
6537
6693
|
}
|
|
6538
6694
|
|
|
6695
|
+
/**
|
|
6696
|
+
* State whether an account deployment can be found from a seed phrase.
|
|
6697
|
+
*
|
|
6698
|
+
* Takes the three `DEPLOY_ACCOUNT` fields that fix an address. An account
|
|
6699
|
+
* that exists but whose address depends on inputs outside the seed (an
|
|
6700
|
+
* Argent guardian, a non-Starknet owner, a server-assigned salt) is
|
|
6701
|
+
* reported as `not_from_seed` with the reason, so a recovery flow can tell
|
|
6702
|
+
* "not discoverable from a phrase" apart from "no such account". Such an
|
|
6703
|
+
* account is still verifiable: check that `address` is the account's and
|
|
6704
|
+
* that `ownerPublicKey` is one of the seed's derived keys. `guardianPublicKey`
|
|
6705
|
+
* is the deploy-time guardian, which is the one that fixes the address; an
|
|
6706
|
+
* account's current guardian can have changed since.
|
|
6707
|
+
*
|
|
6708
|
+
* Pass the class hash from the deploy transaction, not the class the account
|
|
6709
|
+
* runs today: for an upgraded account the current class is an implementation
|
|
6710
|
+
* class and the answer is `not_from_seed` / `implementation_class`.
|
|
6711
|
+
*
|
|
6712
|
+
* # Arguments
|
|
6713
|
+
* * `class_hash` - `DEPLOY_ACCOUNT.class_hash` (hex string)
|
|
6714
|
+
* * `salt` - `DEPLOY_ACCOUNT.contract_address_salt` (hex string)
|
|
6715
|
+
* * `constructor_calldata` - `DEPLOY_ACCOUNT.constructor_calldata` (hex strings)
|
|
6716
|
+
*
|
|
6717
|
+
* # Returns
|
|
6718
|
+
* JSON string with fields:
|
|
6719
|
+
* - `address`: the address these fields fix (deployer zero). Compare it with
|
|
6720
|
+
* the account being checked before trusting anything else in the result:
|
|
6721
|
+
* the fields are usually an RPC response, and fields that do not hash to
|
|
6722
|
+
* the account say nothing about it
|
|
6723
|
+
* - `known`: whether the class hash is in the registry
|
|
6724
|
+
* - `class`: the registry entry (see `getAccountClassRegistry`), or `null`
|
|
6725
|
+
* - `ownerPublicKey`: the Stark key the constructor binds as owner, or `null`
|
|
6726
|
+
* - `guardianPublicKey`: the guardian's Stark key when a Starknet-key
|
|
6727
|
+
* guardian is set, or `null`
|
|
6728
|
+
* - `derivability`: "from_seed" | "not_from_seed" | "unknown_class"
|
|
6729
|
+
* - `reason`: for `not_from_seed`, one of "guardian" | "non_starknet_owner" |
|
|
6730
|
+
* "salt_not_public_key" | "implementation_class" | "proxy_target_class" |
|
|
6731
|
+
* "unknown_proxy_implementation" | "unexpected_constructor_calldata";
|
|
6732
|
+
* otherwise `null`
|
|
6733
|
+
* @param {string} class_hash
|
|
6734
|
+
* @param {string} salt
|
|
6735
|
+
* @param {string[]} constructor_calldata
|
|
6736
|
+
* @returns {string}
|
|
6737
|
+
*/
|
|
6738
|
+
export function inspectAccountDeployment(class_hash, salt, constructor_calldata) {
|
|
6739
|
+
let deferred5_0;
|
|
6740
|
+
let deferred5_1;
|
|
6741
|
+
try {
|
|
6742
|
+
const ptr0 = passStringToWasm0(class_hash, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
6743
|
+
const len0 = WASM_VECTOR_LEN;
|
|
6744
|
+
const ptr1 = passStringToWasm0(salt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
6745
|
+
const len1 = WASM_VECTOR_LEN;
|
|
6746
|
+
const ptr2 = passArrayJsValueToWasm0(constructor_calldata, wasm.__wbindgen_malloc);
|
|
6747
|
+
const len2 = WASM_VECTOR_LEN;
|
|
6748
|
+
const ret = wasm.inspectAccountDeployment(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
6749
|
+
var ptr4 = ret[0];
|
|
6750
|
+
var len4 = ret[1];
|
|
6751
|
+
if (ret[3]) {
|
|
6752
|
+
ptr4 = 0; len4 = 0;
|
|
6753
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
6754
|
+
}
|
|
6755
|
+
deferred5_0 = ptr4;
|
|
6756
|
+
deferred5_1 = len4;
|
|
6757
|
+
return getStringFromWasm0(ptr4, len4);
|
|
6758
|
+
} finally {
|
|
6759
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
6760
|
+
}
|
|
6761
|
+
}
|
|
6762
|
+
|
|
6539
6763
|
/**
|
|
6540
6764
|
* Check whether a hex string is a valid Stark field element.
|
|
6541
6765
|
*
|
package/krusty_kms_wasm_bg.wasm
CHANGED
|
Binary file
|