@starknetfoundation/krusty-kms-wasm 0.10.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 +220 -61
- package/krusty_kms_wasm.js +246 -18
- package/krusty_kms_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/krusty_kms_wasm.d.ts
CHANGED
|
@@ -1007,18 +1007,60 @@ export function decryptWithKey(nonce: string, ciphertext: string, key_hex: strin
|
|
|
1007
1007
|
/**
|
|
1008
1008
|
* Derive an Argent account contract address from a public key.
|
|
1009
1009
|
*
|
|
1010
|
-
* Uses the standard Argent
|
|
1010
|
+
* Uses the standard Argent deployment (salt = public key, Starknet-key owner,
|
|
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`.
|
|
1011
1020
|
*
|
|
1012
1021
|
* # Arguments
|
|
1013
1022
|
* * `public_key` - The Stark public key (hex string)
|
|
1014
|
-
* * `class_hash` - Optional
|
|
1015
|
-
*
|
|
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.
|
|
1016
1033
|
*
|
|
1017
1034
|
* # Returns
|
|
1018
1035
|
* The derived account contract address as hex string
|
|
1019
1036
|
*/
|
|
1020
1037
|
export function deriveArgentAccountAddress(public_key: string, class_hash?: string | null): string;
|
|
1021
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
|
+
|
|
1022
1064
|
/**
|
|
1023
1065
|
* Derive a Starknet keypair using old Argent's "double derivation" scheme.
|
|
1024
1066
|
*
|
|
@@ -1056,12 +1098,19 @@ export function deriveArgentLegacyPublicKey(mnemonic: string, address_index: num
|
|
|
1056
1098
|
/**
|
|
1057
1099
|
* Derive a Braavos account contract address from a public key.
|
|
1058
1100
|
*
|
|
1059
|
-
* 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.
|
|
1060
1106
|
*
|
|
1061
1107
|
* # Arguments
|
|
1062
1108
|
* * `public_key` - The Stark public key (hex string)
|
|
1063
|
-
* * `class_hash` - Optional
|
|
1064
|
-
*
|
|
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.
|
|
1065
1114
|
*
|
|
1066
1115
|
* # Returns
|
|
1067
1116
|
* The derived account contract address as hex string
|
|
@@ -1098,7 +1147,7 @@ export function deriveBraavosAccountAddress(public_key: string, class_hash?: str
|
|
|
1098
1147
|
* // Use public keys to query Argent's smart account API
|
|
1099
1148
|
* for (const kp of keypairs) {
|
|
1100
1149
|
* const smartAccounts = await argentApi.findAccountsByPublicKey(kp.publicKey);
|
|
1101
|
-
* // smartAccounts contains
|
|
1150
|
+
* // smartAccounts contains accounts whose salt was assigned server-side
|
|
1102
1151
|
* }
|
|
1103
1152
|
* ```
|
|
1104
1153
|
*/
|
|
@@ -1332,12 +1381,10 @@ export function foldStrk20ViewingKey(public_key: string, message_hash: string, r
|
|
|
1332
1381
|
*
|
|
1333
1382
|
* # Why every address, not just the first
|
|
1334
1383
|
*
|
|
1335
|
-
* A wallet type
|
|
1336
|
-
*
|
|
1337
|
-
*
|
|
1338
|
-
*
|
|
1339
|
-
* one address per wallet type silently hides deployed accounts — every
|
|
1340
|
-
* 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.
|
|
1341
1388
|
*
|
|
1342
1389
|
* # Returns
|
|
1343
1390
|
* JSON string: `{ "0": { "Braavos": ["0x..."], "OpenZeppelin": ["0x...", "0x..."], ... } }`
|
|
@@ -1353,7 +1400,9 @@ export function generateAccountAddresses(mnemonic: string, max_index?: number |
|
|
|
1353
1400
|
* This is a pure cryptographic operation — no network calls are made.
|
|
1354
1401
|
* Each candidate is a possible on-chain account address. To find which
|
|
1355
1402
|
* ones are actually deployed, check each address via an RPC provider
|
|
1356
|
-
* (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.
|
|
1357
1406
|
*
|
|
1358
1407
|
* # Security
|
|
1359
1408
|
*
|
|
@@ -1373,7 +1422,7 @@ export function generateAccountAddresses(mnemonic: string, max_index?: number |
|
|
|
1373
1422
|
* - `publicKey`: hex string
|
|
1374
1423
|
* - `derivationIndex`: number
|
|
1375
1424
|
* - `derivationPath`: string (e.g., "m/44'/9004'/0'/0/0")
|
|
1376
|
-
* - `classVersion`: string (e.g., "v0.4.0", "
|
|
1425
|
+
* - `classVersion`: string (e.g., "v0.4.0", "base v1.1.0")
|
|
1377
1426
|
*
|
|
1378
1427
|
* # Example (JavaScript)
|
|
1379
1428
|
* ```javascript
|
|
@@ -1439,14 +1488,80 @@ export function generateWithdrawProof(account: WasmAccount, params: WasmWithdraw
|
|
|
1439
1488
|
/**
|
|
1440
1489
|
* Get known account class hashes for common Starknet account implementations.
|
|
1441
1490
|
*
|
|
1442
|
-
*
|
|
1443
|
-
*
|
|
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.
|
|
1444
1503
|
*
|
|
1445
1504
|
* # Returns
|
|
1446
|
-
* JSON string with nested object:
|
|
1505
|
+
* JSON string with nested object:
|
|
1506
|
+
* `{ oz: { ... }, argent: { ... }, argent_legacy: { ... }, braavos: { ... } }`
|
|
1447
1507
|
*/
|
|
1448
1508
|
export function getAccountClassHashes(): string;
|
|
1449
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
|
+
|
|
1450
1565
|
/**
|
|
1451
1566
|
* Get build information.
|
|
1452
1567
|
*/
|
|
@@ -1509,6 +1624,47 @@ export function grindKey(seed_hex: string): string;
|
|
|
1509
1624
|
*/
|
|
1510
1625
|
export function init(): void;
|
|
1511
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
|
+
|
|
1512
1668
|
/**
|
|
1513
1669
|
* Check whether a hex string is a valid Stark field element.
|
|
1514
1670
|
*
|
|
@@ -2073,17 +2229,24 @@ export interface InitOutput {
|
|
|
2073
2229
|
readonly __wbg_set_wasmstarkxonlykeypair_private_key: (a: number, b: number, c: number) => void;
|
|
2074
2230
|
readonly __wbg_set_wasmstarkxonlykeypair_public_key_x: (a: number, b: number, c: number) => void;
|
|
2075
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];
|
|
2076
2245
|
readonly deriveNostrKeypair: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
2077
2246
|
readonly deriveNostrPublicKey: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
2078
|
-
readonly
|
|
2079
|
-
readonly
|
|
2080
|
-
readonly
|
|
2081
|
-
readonly foldStrk20ViewingKey: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
2082
|
-
readonly getSelectorFromName: (a: number, b: number) => [number, number, number, number];
|
|
2083
|
-
readonly pedersenHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2084
|
-
readonly pedersenHashMany: (a: number, b: number) => [number, number, number, number];
|
|
2085
|
-
readonly starknetKeccak: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2086
|
-
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];
|
|
2087
2250
|
readonly wasmaccount_contractAddress: (a: number) => [number, number];
|
|
2088
2251
|
readonly wasmaccount_decryptBalance: (a: number, b: number, c: number, d: bigint) => [number, number, number, number];
|
|
2089
2252
|
readonly wasmaccount_decryptToPoint: (a: number, b: number) => [number, number, number];
|
|
@@ -2094,15 +2257,23 @@ export interface InitOutput {
|
|
|
2094
2257
|
readonly wasmaccount_ownerPublicKeyHex: (a: number) => [number, number, number, number];
|
|
2095
2258
|
readonly wasmaccount_totalBalance: (a: number) => [number, number, number, number];
|
|
2096
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;
|
|
2097
2264
|
readonly deserializePublicKey: (a: number, b: number) => [number, number, number];
|
|
2098
2265
|
readonly getBuildInfo: () => any;
|
|
2099
2266
|
readonly getGenerator: () => number;
|
|
2100
2267
|
readonly getVersion: () => [number, number];
|
|
2268
|
+
readonly grindKey: (a: number, b: number) => [number, number, number, number];
|
|
2101
2269
|
readonly init: () => void;
|
|
2270
|
+
readonly isValidFelt: (a: number, b: number) => number;
|
|
2271
|
+
readonly isValidStarkPrivateKey: (a: number, b: number) => number;
|
|
2102
2272
|
readonly nostrPublicKey: (a: number, b: number) => [number, number, number, number];
|
|
2103
2273
|
readonly pointAdd: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
|
|
2104
2274
|
readonly poseidonHash: (a: number, b: number, c: number, d: number) => [number, number, number, number];
|
|
2105
2275
|
readonly poseidonHashMany: (a: number, b: number) => [number, number, number, number];
|
|
2276
|
+
readonly randomBytesHex: (a: number) => [number, number, number, number];
|
|
2106
2277
|
readonly randomFelt: () => [number, number];
|
|
2107
2278
|
readonly scalarMul: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
|
|
2108
2279
|
readonly scalarMulGenerator: (a: number, b: number) => [number, number, number];
|
|
@@ -2111,13 +2282,10 @@ export interface InitOutput {
|
|
|
2111
2282
|
readonly signNostrMessage: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
2112
2283
|
readonly signStarkHash: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
2113
2284
|
readonly starkPublicKey: (a: number, b: number) => [number, number, number, number];
|
|
2114
|
-
readonly
|
|
2115
|
-
readonly
|
|
2116
|
-
readonly
|
|
2117
|
-
readonly
|
|
2118
|
-
readonly getAccountClassHashes: () => [number, number];
|
|
2119
|
-
readonly openNostrApplicationData: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
|
|
2120
|
-
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];
|
|
2121
2289
|
readonly deriveArgentLegacyKeypair: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
2122
2290
|
readonly deriveArgentLegacyPublicKey: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
2123
2291
|
readonly deriveDiscoveryKeypairs: (a: number, b: number, c: number) => [number, number, number, number];
|
|
@@ -2136,33 +2304,18 @@ export interface InitOutput {
|
|
|
2136
2304
|
readonly getStarknetCoinType: () => number;
|
|
2137
2305
|
readonly getTongoCoinType: () => number;
|
|
2138
2306
|
readonly validateMnemonic: (a: number, b: number) => number;
|
|
2139
|
-
readonly
|
|
2140
|
-
readonly
|
|
2141
|
-
readonly
|
|
2142
|
-
readonly
|
|
2143
|
-
readonly
|
|
2144
|
-
readonly
|
|
2145
|
-
readonly
|
|
2146
|
-
readonly
|
|
2147
|
-
readonly
|
|
2148
|
-
readonly
|
|
2149
|
-
readonly
|
|
2150
|
-
readonly
|
|
2151
|
-
readonly encryptKeystore: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
2152
|
-
readonly encryptPrivateKey: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
2153
|
-
readonly encryptWithKey: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
2154
|
-
readonly grindKey: (a: number, b: number) => [number, number, number, number];
|
|
2155
|
-
readonly isValidFelt: (a: number, b: number) => number;
|
|
2156
|
-
readonly isValidStarkPrivateKey: (a: number, b: number) => number;
|
|
2157
|
-
readonly randomBytesHex: (a: number) => [number, number, number, number];
|
|
2158
|
-
readonly __wbg_get_wasmencryptedpayload_ciphertext: (a: number) => [number, number];
|
|
2159
|
-
readonly __wbg_get_wasmencryptedpayload_nonce: (a: number) => [number, number];
|
|
2160
|
-
readonly __wbg_set_wasmencryptedpayload_ciphertext: (a: number, b: number, c: number) => void;
|
|
2161
|
-
readonly __wbg_set_wasmencryptedpayload_nonce: (a: number, b: number, c: number) => void;
|
|
2162
|
-
readonly compileCalls: (a: number, b: number) => [number, number, number, number];
|
|
2163
|
-
readonly decodeShortString: (a: number, b: number) => [number, number, number, number];
|
|
2164
|
-
readonly encodeFelt: (a: number, b: number) => [number, number, number, number];
|
|
2165
|
-
readonly encodeShortString: (a: number, b: number) => [number, number, 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];
|
|
2166
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];
|
|
2167
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];
|
|
2168
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];
|
|
@@ -2170,6 +2323,12 @@ export interface InitOutput {
|
|
|
2170
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];
|
|
2171
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];
|
|
2172
2325
|
readonly computeTypedDataMessageHash: (a: number, b: number, c: number, d: 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];
|
|
2173
2332
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
2174
2333
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
2175
2334
|
readonly __wbindgen_exn_store: (a: number) => void;
|
package/krusty_kms_wasm.js
CHANGED
|
@@ -5343,12 +5343,29 @@ export function decryptWithKey(nonce, ciphertext, key_hex) {
|
|
|
5343
5343
|
/**
|
|
5344
5344
|
* Derive an Argent account contract address from a public key.
|
|
5345
5345
|
*
|
|
5346
|
-
* Uses the standard Argent
|
|
5346
|
+
* Uses the standard Argent deployment (salt = public key, Starknet-key owner,
|
|
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`.
|
|
5347
5356
|
*
|
|
5348
5357
|
* # Arguments
|
|
5349
5358
|
* * `public_key` - The Stark public key (hex string)
|
|
5350
|
-
* * `class_hash` - Optional
|
|
5351
|
-
*
|
|
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.
|
|
5352
5369
|
*
|
|
5353
5370
|
* # Returns
|
|
5354
5371
|
* The derived account contract address as hex string
|
|
@@ -5379,6 +5396,58 @@ export function deriveArgentAccountAddress(public_key, class_hash) {
|
|
|
5379
5396
|
}
|
|
5380
5397
|
}
|
|
5381
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
|
+
|
|
5382
5451
|
/**
|
|
5383
5452
|
* Derive a Starknet keypair using old Argent's "double derivation" scheme.
|
|
5384
5453
|
*
|
|
@@ -5440,12 +5509,19 @@ export function deriveArgentLegacyPublicKey(mnemonic, address_index, account_ind
|
|
|
5440
5509
|
/**
|
|
5441
5510
|
* Derive a Braavos account contract address from a public key.
|
|
5442
5511
|
*
|
|
5443
|
-
* 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.
|
|
5444
5517
|
*
|
|
5445
5518
|
* # Arguments
|
|
5446
5519
|
* * `public_key` - The Stark public key (hex string)
|
|
5447
|
-
* * `class_hash` - Optional
|
|
5448
|
-
*
|
|
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.
|
|
5449
5525
|
*
|
|
5450
5526
|
* # Returns
|
|
5451
5527
|
* The derived account contract address as hex string
|
|
@@ -5506,7 +5582,7 @@ export function deriveBraavosAccountAddress(public_key, class_hash) {
|
|
|
5506
5582
|
* // Use public keys to query Argent's smart account API
|
|
5507
5583
|
* for (const kp of keypairs) {
|
|
5508
5584
|
* const smartAccounts = await argentApi.findAccountsByPublicKey(kp.publicKey);
|
|
5509
|
-
* // smartAccounts contains
|
|
5585
|
+
* // smartAccounts contains accounts whose salt was assigned server-side
|
|
5510
5586
|
* }
|
|
5511
5587
|
* ```
|
|
5512
5588
|
* @param {string} mnemonic
|
|
@@ -6127,12 +6203,10 @@ export function foldStrk20ViewingKey(public_key, message_hash, r, s) {
|
|
|
6127
6203
|
*
|
|
6128
6204
|
* # Why every address, not just the first
|
|
6129
6205
|
*
|
|
6130
|
-
* A wallet type
|
|
6131
|
-
*
|
|
6132
|
-
*
|
|
6133
|
-
*
|
|
6134
|
-
* one address per wallet type silently hides deployed accounts — every
|
|
6135
|
-
* 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.
|
|
6136
6210
|
*
|
|
6137
6211
|
* # Returns
|
|
6138
6212
|
* JSON string: `{ "0": { "Braavos": ["0x..."], "OpenZeppelin": ["0x...", "0x..."], ... } }`
|
|
@@ -6170,7 +6244,9 @@ export function generateAccountAddresses(mnemonic, max_index) {
|
|
|
6170
6244
|
* This is a pure cryptographic operation — no network calls are made.
|
|
6171
6245
|
* Each candidate is a possible on-chain account address. To find which
|
|
6172
6246
|
* ones are actually deployed, check each address via an RPC provider
|
|
6173
|
-
* (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.
|
|
6174
6250
|
*
|
|
6175
6251
|
* # Security
|
|
6176
6252
|
*
|
|
@@ -6190,7 +6266,7 @@ export function generateAccountAddresses(mnemonic, max_index) {
|
|
|
6190
6266
|
* - `publicKey`: hex string
|
|
6191
6267
|
* - `derivationIndex`: number
|
|
6192
6268
|
* - `derivationPath`: string (e.g., "m/44'/9004'/0'/0/0")
|
|
6193
|
-
* - `classVersion`: string (e.g., "v0.4.0", "
|
|
6269
|
+
* - `classVersion`: string (e.g., "v0.4.0", "base v1.1.0")
|
|
6194
6270
|
*
|
|
6195
6271
|
* # Example (JavaScript)
|
|
6196
6272
|
* ```javascript
|
|
@@ -6374,11 +6450,22 @@ export function generateWithdrawProof(account, params) {
|
|
|
6374
6450
|
/**
|
|
6375
6451
|
* Get known account class hashes for common Starknet account implementations.
|
|
6376
6452
|
*
|
|
6377
|
-
*
|
|
6378
|
-
*
|
|
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.
|
|
6379
6465
|
*
|
|
6380
6466
|
* # Returns
|
|
6381
|
-
* JSON string with nested object:
|
|
6467
|
+
* JSON string with nested object:
|
|
6468
|
+
* `{ oz: { ... }, argent: { ... }, argent_legacy: { ... }, braavos: { ... } }`
|
|
6382
6469
|
* @returns {string}
|
|
6383
6470
|
*/
|
|
6384
6471
|
export function getAccountClassHashes() {
|
|
@@ -6394,6 +6481,79 @@ export function getAccountClassHashes() {
|
|
|
6394
6481
|
}
|
|
6395
6482
|
}
|
|
6396
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
|
+
|
|
6397
6557
|
/**
|
|
6398
6558
|
* Get build information.
|
|
6399
6559
|
* @returns {any}
|
|
@@ -6532,6 +6692,74 @@ export function init() {
|
|
|
6532
6692
|
wasm.init();
|
|
6533
6693
|
}
|
|
6534
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
|
+
|
|
6535
6763
|
/**
|
|
6536
6764
|
* Check whether a hex string is a valid Stark field element.
|
|
6537
6765
|
*
|
package/krusty_kms_wasm_bg.wasm
CHANGED
|
Binary file
|