@medialane/sdk 0.119.2 → 0.120.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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/wallet/store.ts","../../src/wallet/pairing.ts","../../src/chains.ts","../../src/constants.ts","../../src/starknet/business-provisioning/account.ts","../../src/wallet/recovery-key.ts","../../src/wallet/guardian-status.ts","../../src/utils/address.ts","../../src/wallet/addresses.ts","../../src/wallet/self-fund-consent.ts","../../src/starknet/passkey-wallet/crypto.ts","../../src/wallet/passkey.ts","../../src/starknet/services/sponsoredExecutor.ts","../../src/wallet/executors.ts","../../src/starknet/business-provisioning/guardian.ts","../../src/starknet/business-provisioning/handoff.ts","../../src/wallet/client.ts"],"names":["hash","num","starknetTypedData"],"mappings":";;;;;AAWO,SAAS,iBAAiB,MAAA,EAA+D;AAC9F,EAAA,MAAM,EAAE,QAAA,EAAU,WAAA,EAAY,GAAI,MAAA;AAClC,EAAA,MAAM,WAAW,MAAY;AAC3B,IAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,IAAA,MAAA,CAAO,aAAA,CAAc,IAAI,KAAA,CAAM,WAAW,CAAC,CAAA;AAAA,EAC7C,CAAA;AACA,EAAA,OAAO;AAAA,IACL,IAAA,GAAO;AACL,MAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,OAAO,IAAA;AAC1C,MAAA,IAAI;AACF,QAAA,MAAM,GAAA,GAAM,YAAA,CAAa,OAAA,CAAQ,QAAQ,CAAA;AACzC,QAAA,OAAO,GAAA,GAAO,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA,GAAoB,IAAA;AAAA,MAClD,CAAA,CAAA,MAAQ;AACN,QAAA,OAAO,IAAA;AAAA,MACT;AAAA,IACF,CAAA;AAAA,IACA,WAAA,GAAc;AACZ,MAAA,OAAO,IAAA,CAAK,IAAA,EAAK,EAAG,OAAA,IAAW,IAAA;AAAA,IACjC,CAAA;A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,CAAC,CAAA;AACrF,MAAA,OAAO,eAAA;AAAA,IACT,CAAA;AAAA,IAEA,MAAM,SAAA,CAAU,MAAA,EAAQ,YAAA,EAAc;AACpC,MAAA,MAAM,EAAE,eAAA,EAAgB,GAAI,MAAM,GAAA,CAAI,MAAA,EAAQ,CAAC,iBAAA,CAAkB,MAAA,CAAO,OAAA,EAAS,YAAY,CAAC,CAAC,CAAA;AAC/F,MAAA,OAAO,eAAA;AAAA,IACT,CAAA;AAAA,IAEA,MAAM,YAAA,CAAa,MAAA,EAAQ,SAAA,EAAW;AACpC,MAAA,MAAM,EAAE,eAAA,EAAgB,GAAI,MAAM,GAAA,CAAI,MAAA,EAAQ,CAAC,0BAAA,CAA2B,MAAA,CAAO,OAAA,EAAS,SAAS,CAAC,CAAC,CAAA;AACrG,MAAA,OAAO,eAAA;AAAA,IACT;AAAA,GACF;AACF","file":"index.js","sourcesContent":["import type { SealedOwner } from \"./types.js\";\n\nexport interface OwnerStore {\n load(): SealedOwner | null;\n loadAddress(): string | null;\n save(sealed: SealedOwner): void;\n clear(): void;\n notifyChange(): void;\n onChange(listener: () => void): () => void;\n}\n\nexport function createOwnerStore(config: { storeKey: string; changeEvent: string }): OwnerStore {\n const { storeKey, changeEvent } = config;\n const announce = (): void => {\n if (typeof window === \"undefined\") return;\n window.dispatchEvent(new Event(changeEvent));\n };\n return {\n load() {\n if (typeof window === \"undefined\") return null;\n try {\n const raw = localStorage.getItem(storeKey);\n return raw ? (JSON.parse(raw) as SealedOwner) : null;\n } catch {\n return null;\n }\n },\n loadAddress() {\n return this.load()?.address ?? null;\n },\n save(sealed) {\n localStorage.setItem(storeKey, JSON.stringify(sealed));\n announce();\n },\n clear() {\n localStorage.removeItem(storeKey);\n announce();\n },\n notifyChange: announce,\n onChange(listener) {\n window.addEventListener(changeEvent, listener);\n return () => window.removeEventListener(changeEvent, listener);\n },\n };\n}\n","const SCHEME = \"medialane-device\";\nconst VERSION = 1;\nconst LABEL_MAX = 32;\nconst STARK_PRIME = (1n << 251n) + 17n * (1n << 192n) + 1n;\n\nexport class InvalidPairingPayloadError extends Error {\n constructor(message = \"This code is not a Medialane device request.\") {\n super(message);\n this.name = \"InvalidPairingPayloadError\";\n }\n}\n\nexport interface PairingPayload {\n publicKey: string;\n label: string;\n}\n\nfunction normalisePublicKey(input: unknown): string {\n if (typeof input !== \"string\" || !/^0x[0-9a-fA-F]+$/.test(input)) {\n throw new InvalidPairingPayloadError(\"That device key is not valid.\");\n }\n const value = BigInt(input);\n if (value === 0n || value >= STARK_PRIME) {\n throw new InvalidPairingPayloadError(\"That device key is not valid.\");\n }\n return `0x${value.toString(16)}`;\n}\n\nfunction sanitiseLabel(input: unknown): string {\n const raw = typeof input === \"string\" ? input : \"\";\n return raw.replace(/\\s+/g, \" \").trim().slice(0, LABEL_MAX);\n}\n\nexport function encodePairingPayload(payload: PairingPayload): string {\n return JSON.stringify({\n scheme: SCHEME,\n version: VERSION,\n publicKey: normalisePublicKey(payload.publicKey),\n label: sanitiseLabel(payload.label),\n });\n}\n\nexport function parsePairingPayload(encoded: string): PairingPayload {\n let data: Record<string, unknown>;\n try {\n data = JSON.parse(encoded) as Record<string, unknown>;\n } catch {\n throw new InvalidPairingPayloadError();\n }\n if (data === null || typeof data !== \"object\") throw new InvalidPairingPayloadError();\n if (data.scheme !== SCHEME || data.version !== VERSION) throw new InvalidPairingPayloadError();\n return {\n publicKey: normalisePublicKey(data.publicKey),\n label: sanitiseLabel(data.label),\n };\n}\n\nexport function parseAccountAddress(input: string): string {\n const trimmed = typeof input === \"string\" ? input.trim() : \"\";\n if (!/^0x[0-9a-fA-F]{50,64}$/.test(trimmed)) {\n throw new InvalidPairingPayloadError(\"That does not look like an account address.\");\n }\n if (BigInt(trimmed) === 0n) {\n throw new InvalidPairingPayloadError(\"That does not look like an account address.\");\n }\n return trimmed;\n}\n","\n\nexport const CHAINS = [\"STARKNET\", \"ETHEREUM\", \"SOLANA\", \"BASE\", \"STELLAR\", \"BITCOIN\"] as const;\nexport type Chain = (typeof CHAINS)[number];\n\nexport interface StarknetCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721ClassHash?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155ClassHash?: `0x${string}`;\n marketplace1155StartBlock?: number;\n collection721?: `0x${string}`;\n collection721StartBlock?: number;\n dataTokenization721?: `0x${string}`;\n dataTokenization721StartBlock?: number;\n ipNftClassHash?: `0x${string}`;\n ipCollectionClassHash?: `0x${string}`;\n collection1155?: `0x${string}`;\n collection1155FactoryClassHash?: `0x${string}`;\n collection1155ClassHash?: `0x${string}`;\n collection1155StartBlock?: number;\n popFactory?: `0x${string}`;\n popCollectionClassHash?: `0x${string}`;\n dropFactory?: `0x${string}`;\n dropCollectionClassHash?: `0x${string}`;\n nftComments?: `0x${string}`;\n creatorCoinFactory?: `0x${string}`;\n creatorCoinEkuboLauncher?: `0x${string}`;\n creatorCoinClassHash?: `0x${string}`;\n creatorCoinFactoryClassHash?: `0x${string}`;\n creatorCoinStartBlock?: number;\n ekuboCore?: `0x${string}`;\n ipTicketsFactory?: `0x${string}`;\n ipTicketCollectionClassHash?: `0x${string}`;\n ipTicketsFactoryClassHash?: `0x${string}`;\n ipTicketsStartBlock?: number;\n ipClubFactory?: `0x${string}`;\n ipClubFactoryClassHash?: `0x${string}`;\n ipClubCollectionClassHash?: `0x${string}`;\n ipClubFactoryStartBlock?: number;\n ipSponsorship?: `0x${string}`;\n ipSponsorshipClassHash?: `0x${string}`;\n ipSponsorshipStartBlock?: number;\n mediaWalletClassHash?: `0x${string}`;\n genesisMintLaunch?: `0x${string}`;\n genesisMintBR?: `0x${string}`;\n genesisMintGlobal?: `0x${string}`;\n}\n\nexport interface EvmCoordinates {\n rpcUrl: string;\n marketplace721?: `0x${string}`;\n marketplace721StartBlock?: number;\n marketplace1155?: `0x${string}`;\n marketplace1155StartBlock?: number;\n mipRegistry?: `0x${string}`;\n mipRegistryStartBlock?: number;\n mipEditionsRegistry?: `0x${string}`;\n mipEditionsRegistryStartBlock?: number;\n}\n\nexport interface SolanaCoordinates {\n rpcUrl: string;\n mipCollectionsProgram?: string;\n marketplaceProgram?: string;\n startSlot?: number;\n}\n\nexport interface StellarCoordinates {\n rpcUrl: string;\n mipRegistry?: string;\n marketplace?: string;\n collectionWasmHash?: string;\n startLedger?: number;\n}\n\nexport interface CoordinatesByChain {\n STARKNET?: StarknetCoordinates;\n ETHEREUM?: EvmCoordinates;\n BASE?: EvmCoordinates;\n SOLANA?: SolanaCoordinates;\n STELLAR?: StellarCoordinates;\n BITCOIN?: never;\n}\n\nexport type ChainCoordinates = StarknetCoordinates;\n\nconst COORDINATES: CoordinatesByChain = {\n STARKNET: {\n rpcUrl: \"https://rpc.starknet.lava.build\",\n marketplace721: \"0x03eda9a2b6ad90845a43591bac8083ebaf677d51fdf20f503b2c01889e3131fc\",\n marketplace721ClassHash: \"0x0700d9230d07e5203e27778c0dc70f9134d2b25bf319f7cf8348dc66a6923e90\",\n marketplace721StartBlock: 11198146,\n marketplace1155: \"0x07c4ce1c19ea48cc11135ed22b19ff745f5aec508c3828593002e4f76fdb1b38\",\n marketplace1155ClassHash: \"0x0242f5c388da7cee2d99e2a69453c8159bf927fbec4e797a3cfdcbbcb5b68328\",\n marketplace1155StartBlock: 11198267,\n collection721: \"0x0225c3ae09506b8d97adc39649ca740dad5aac195b7f5f0441cc1852947acaea\",\n collection721StartBlock: 11198496,\n dataTokenization721: \"0x07421b4442f7f2052c65408fb3561484154cf8175a0bbb41e3cd38d9087af6d2\",\n dataTokenization721StartBlock: 14670294,\n ipNftClassHash: \"0x012d3ae40ba35c7e2be0946532dac60e48932447912fdf96b674da67c029b9cc\",\n ipCollectionClassHash: \"0x022155a1a130a40e57aac4b89c07fab3f616bc351b1270fc40f756b963afe8b4\",\n collection1155: \"0x015368976d46fae5bfa1c58600f641d5aa5dbbf53ebc6b78aa3922194aad3551\",\n collection1155FactoryClassHash: \"0x04eb6b419770f13bd191f120b9fc9ee624c0613ad4490062d293ca2016b3b1d2\",\n collection1155ClassHash: \"0x06cf3f5a2322dac35e07a6064a5b8802f19fda8aa3f4726f0cb7bc05dea1bd78\",\n collection1155StartBlock: 11199527,\n popFactory: \"0x00b32c34b427d8f346b5843ada6a37bd3368d879fc752cd52b68a87287f60111\",\n popCollectionClassHash: \"0x077c421686f10851872561953ea16898d933364b7f8937a5d7e2b1ba0a36263f\",\n dropFactory: \"0x03587f42e29daee1b193f6cf83bf8627908ed6632d0d83fcb26225c50547d800\",\n dropCollectionClassHash: \"0x00092e72cdb63067521e803aaf7d4101c3e3ce026ae6bc045ec4228027e58282\",\n nftComments: \"0x02cdac70c94447189af0389dfea63f4d5e4154ea8a563de288a5ab1c39e37843\",\n creatorCoinFactory: \"0x50fa807b5274079fb19374673d7bab6d2dc3af7e1032ea43eb6e44bcbde4c3c\",\n creatorCoinEkuboLauncher: \"0x4f7fceb5ac10f12f9544a09580592e5bdf1b7f04f48765eecf12286d8ccb7b4\",\n creatorCoinClassHash: \"0x743e4c8a5b96bb83bbf4af04edbbb482d5ece89eed9b729a79fb7df0cd0b6b6\",\n creatorCoinFactoryClassHash: \"0x51765926b1344c9a20b8cd4b5abe7b7d47375ae97cf6804db3ea5d4b05a9b55\",\n creatorCoinStartBlock: 10474544,\n ekuboCore: \"0x00000005dd3d2f4429af886cd1a3b08289dbcea99a294197e9eb43b0e0325b4b\",\n ipTicketsFactory: \"0x0767bf5b57e1f812463159b5ed683183e1b0c3f942b74871b5c6cd6a93c15e99\",\n ipTicketCollectionClassHash: \"0x0449e8eb7c117740d07cb8e0157d32c8ba3d19d1cfd2784ed5e139f5a1e04acc\",\n ipTicketsFactoryClassHash: \"0x04a739ac3a673ebd0db96bb24475600797c3ed34827e79517f9b2b1640276e6a\",\n ipTicketsStartBlock: 11933694,\n ipClubFactory: \"0x06a0b0be16d70c78f2e18119dbf90e5911cbfd5d8d484bc555dc61d96f56a2b9\",\n ipClubFactoryClassHash: \"0x05d9d431bd3532b1fa4d5bab572f49c5ad8034ee3cc83951aa41ae82c9cad266\",\n ipClubCollectionClassHash: \"0x05b8477c72e6bf0cf64967d71155021fd4d77d9a57e8805c6b40709121c002c5\",\n ipClubFactoryStartBlock: 11928775,\n\n ipSponsorship: \"0x03729ebe0fedf29ec97fca34db09174772af7f870af26a26e024a61040143e5c\",\n ipSponsorshipClassHash: \"0x0626daac2ed7e2bf630ef5b10104b3202db1559216c0c1a504c0e99be2fbfec3\",\n ipSponsorshipStartBlock: 11896456,\n mediaWalletClassHash: \"0x014b210c7d47392691144bafecdca3c6c7791cc295ea305988da0a724c05ac31\",\n genesisMintLaunch: \"0x06ed61abba98a44d45bed2c4b1a456df15053c3321cfd6e007afb33b7226c9f0\",\n genesisMintBR: \"0x01f8b92e3b9e963b8eacb075207e2cc89d4614ff2ac6c2702c7ae10ad19a9db8\",\n genesisMintGlobal: \"0x06ad4d55ed2d12ad5d6d55587d800874ef807b051bfefe13497e60ec5b019369\",\n },\n};\n\nexport function getCoordinates(chain: \"STARKNET\"): StarknetCoordinates;\nexport function getCoordinates(chain: \"ETHEREUM\" | \"BASE\"): EvmCoordinates;\nexport function getCoordinates(chain: \"SOLANA\"): SolanaCoordinates;\nexport function getCoordinates(chain: \"STELLAR\"): StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates;\nexport function getCoordinates(\n chain: Chain,\n): StarknetCoordinates | EvmCoordinates | SolanaCoordinates | StellarCoordinates {\n const c = COORDINATES[chain];\n if (!c) throw new Error(`No coordinates configured for chain \"${chain}\"`);\n return c;\n}\n\nexport const DEFAULT_CHAIN: Chain = \"STARKNET\";\n\nexport function getStarknetCoordinates(chain: Chain): StarknetCoordinates {\n if (chain !== \"STARKNET\") {\n throw new Error(`This module is Starknet-only (client chain: \"${chain}\")`);\n }\n return getCoordinates(\"STARKNET\");\n}\n","import { getCoordinates } from \"./chains.js\";\n\nconst SN = getCoordinates(\"STARKNET\");\n\nexport const STARKNET_MARKETPLACE_721_CONTRACT = SN.marketplace721!;\nexport const STARKNET_MARKETPLACE_721_CLASS_HASH = SN.marketplace721ClassHash!;\nexport const STARKNET_MARKETPLACE_721_START_BLOCK = SN.marketplace721StartBlock!;\nexport const STARKNET_MARKETPLACE_1155_CONTRACT = SN.marketplace1155!;\nexport const STARKNET_MARKETPLACE_1155_CLASS_HASH = SN.marketplace1155ClassHash!;\nexport const STARKNET_MARKETPLACE_1155_START_BLOCK = SN.marketplace1155StartBlock!;\n\nexport const STARKNET_COLLECTION_721_CONTRACT = SN.collection721!;\nexport const STARKNET_DATA_TOKENIZATION_721_CONTRACT = SN.dataTokenization721!;\nexport const STARKNET_COLLECTION_721_START_BLOCK = SN.collection721StartBlock!;\nexport const STARKNET_IPNFT_CLASS_HASH = SN.ipNftClassHash!;\nexport const STARKNET_IPCOLLECTION_CLASS_HASH = SN.ipCollectionClassHash!;\nexport const STARKNET_COLLECTION_1155_CONTRACT = SN.collection1155!;\nexport const STARKNET_COLLECTION_1155_FACTORY_CLASS_HASH = SN.collection1155FactoryClassHash!;\nexport const STARKNET_COLLECTION_1155_CLASS_HASH = SN.collection1155ClassHash!;\nexport const STARKNET_COLLECTION_1155_START_BLOCK = SN.collection1155StartBlock!;\n\nexport const STARKNET_POP_FACTORY_CONTRACT = SN.popFactory!;\nexport const STARKNET_POP_COLLECTION_CLASS_HASH = SN.popCollectionClassHash!;\nexport const STARKNET_DROP_FACTORY_CONTRACT = SN.dropFactory!;\nexport const STARKNET_DROP_COLLECTION_CLASS_HASH = SN.dropCollectionClassHash!;\nexport const STARKNET_NFTCOMMENTS_CONTRACT = SN.nftComments!;\n\nexport const STARKNET_IP_TICKETS_FACTORY_CONTRACT = SN.ipTicketsFactory!;\nexport const STARKNET_IP_TICKET_COLLECTION_CLASS_HASH = SN.ipTicketCollectionClassHash!;\nexport const STARKNET_IP_CLUB_FACTORY_CONTRACT = SN.ipClubFactory!;\nexport const STARKNET_IP_CLUB_COLLECTION_CLASS_HASH = SN.ipClubCollectionClassHash!;\nexport const STARKNET_IP_SPONSORSHIP_CONTRACT = SN.ipSponsorship!;\nexport const STARKNET_IP_SPONSORSHIP_CLASS_HASH = SN.ipSponsorshipClassHash!;\n\nexport const STARKNET_MEDIAWALLET_CLASS_HASH = SN.mediaWalletClassHash!;\n\nexport const STARKNET_CREATOR_COIN_FACTORY_CONTRACT = SN.creatorCoinFactory!;\nexport const STARKNET_CREATOR_COIN_EKUBO_LAUNCHER = SN.creatorCoinEkuboLauncher!;\nexport const STARKNET_CREATOR_COIN_CLASS_HASH = SN.creatorCoinClassHash!;\nexport const STARKNET_CREATOR_COIN_FACTORY_CLASS_HASH = SN.creatorCoinFactoryClassHash!;\nexport const STARKNET_CREATOR_COIN_START_BLOCK = SN.creatorCoinStartBlock!;\n\nexport const STARKNET_GENESIS_MINT_LAUNCH_CONTRACT = SN.genesisMintLaunch!;\nexport const STARKNET_GENESIS_MINT_BR_CONTRACT = SN.genesisMintBR!;\nexport const STARKNET_GENESIS_MINT_GLOBAL_CONTRACT = SN.genesisMintGlobal!;\nexport const STARKNET_EKUBO_CORE = SN.ekuboCore!;\n\nexport const SUPPORTED_TOKENS = [\n {\n\n symbol: \"USDC\",\n address:\n \"0x033068f6539f8e6e6b131e6b2b814e6c34a5224bc66947c47dab9dfee93b35fb\",\n decimals: 6,\n listable: true,\n },\n {\n symbol: \"USDT\",\n address:\n \"0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8\",\n decimals: 6,\n listable: true,\n },\n {\n symbol: \"ETH\",\n address:\n \"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7\",\n decimals: 18,\n listable: true,\n },\n {\n symbol: \"STRK\",\n address:\n \"0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d\",\n decimals: 18,\n listable: true,\n },\n {\n symbol: \"WBTC\",\n address:\n \"0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac\",\n decimals: 8,\n listable: true,\n },\n] as const;\n\nexport type SupportedTokenSymbol = (typeof SUPPORTED_TOKENS)[number][\"symbol\"];\n\nexport const DEFAULT_CURRENCY: SupportedTokenSymbol = \"USDC\";\n","import { hash, num, type BigNumberish } from \"starknet\";\nimport { STARKNET_MEDIAWALLET_CLASS_HASH } from \"../../constants.js\";\n\nexport function ownerConstructorCalldata(ownerPubkey: BigNumberish): string[] {\n return [\"0x0\", num.toHex(ownerPubkey), \"0x1\"];\n}\n\nexport function computeAccountAddress(ownerPubkey: BigNumberish, salt: BigNumberish = 0): string {\n return hash.calculateContractAddressFromHash(\n num.toHex(salt),\n STARKNET_MEDIAWALLET_CLASS_HASH,\n ownerConstructorCalldata(ownerPubkey),\n 0,\n );\n}\n","import { computeAccountAddress } from \"../starknet/business-provisioning/account.js\";\nimport type { SealedOwner } from \"./types.js\";\n\nexport function isRecoveryKeyForWallet(sealed: SealedOwner): boolean {\n try {\n return BigInt(computeAccountAddress(sealed.ownerPubKey, 0)) === BigInt(sealed.address);\n } catch {\n return false;\n }\n}\n","import type { GuardianInfo, EscapeInfo } from \"../starknet/business-provisioning/guardian.js\";\n\nexport type GuardianStatus = { kind: \"none\" } | { kind: \"active\"; guardian: GuardianInfo };\n\nexport function describeGuardianStatus(guardians: GuardianInfo[]): GuardianStatus {\n if (guardians.length === 0) return { kind: \"none\" };\n return { kind: \"active\", guardian: guardians[0] };\n}\n\nexport type RecoveryAction = \"start\" | \"complete\" | \"none\";\n\nexport function describeRecoveryAction(escape: EscapeInfo): RecoveryAction {\n if (escape.escapeType !== \"Owner\") return \"none\";\n if (escape.status === \"Ready\") return \"complete\";\n if (escape.status === \"Expired\") return \"start\";\n return \"none\";\n}\n","import { keccak_256 } from \"@noble/hashes/sha3.js\";\nimport { base32, base58 } from \"@scure/base\";\nimport type { Chain } from \"../chains.js\";\n\nexport function normalizeAddress(chain: Chain, address: string): string {\n switch (chain) {\n case \"STARKNET\":\n return normalizeStarknet(address);\n case \"ETHEREUM\":\n case \"BASE\":\n return normalizeEvm(address);\n case \"SOLANA\":\n return normalizeSolana(address);\n case \"STELLAR\":\n return normalizeStellar(address);\n case \"BITCOIN\":\n throw new Error(\"BITCOIN address normalization not implemented\");\n }\n}\n\nfunction normalizeStarknet(address: string): string {\n try {\n const hex = BigInt(address).toString(16);\n return \"0x\" + hex.padStart(64, \"0\").toLowerCase();\n } catch {\n throw new Error(`Invalid STARKNET address: \"${address}\"`);\n }\n}\n\nfunction normalizeEvm(address: string): string {\n const m = /^0x([0-9a-fA-F]{40})$/.exec(address);\n if (!m) throw new Error(`Invalid ETHEREUM/BASE address: \"${address}\"`);\n const lower = m[1].toLowerCase();\n\n const hash = keccak_256(new TextEncoder().encode(lower));\n let out = \"0x\";\n for (let i = 0; i < 40; i++) {\n const nibble = (hash[i >> 1]! >> (i % 2 === 0 ? 4 : 0)) & 0xf;\n out += nibble >= 8 ? lower[i]!.toUpperCase() : lower[i];\n }\n return out;\n}\n\nfunction normalizeSolana(address: string): string {\n try {\n const bytes = base58.decode(address);\n if (bytes.length !== 32) throw new Error(\"not a 32-byte key\");\n return address;\n } catch {\n throw new Error(`Invalid SOLANA address: \"${address}\"`);\n }\n}\n\nconst STELLAR_VERSION_BYTES = new Set([6 << 3, 2 << 3]);\n\nfunction normalizeStellar(address: string): string {\n const upper = address.toUpperCase();\n if (!/^[GC][A-Z2-7]{55}$/.test(upper)) {\n throw new Error(`Invalid STELLAR address: \"${address}\"`);\n }\n let decoded: Uint8Array;\n try {\n decoded = base32.decode(upper);\n } catch {\n throw new Error(`Invalid STELLAR address: \"${address}\"`);\n }\n if (decoded.length !== 35 || !STELLAR_VERSION_BYTES.has(decoded[0]!)) {\n throw new Error(`Invalid STELLAR address: \"${address}\"`);\n }\n const payload = decoded.subarray(0, 33);\n const checksum = decoded[33]! | (decoded[34]! << 8);\n if (crc16xmodem(payload) !== checksum) {\n throw new Error(`Invalid STELLAR address: \"${address}\"`);\n }\n return upper;\n}\n\nfunction crc16xmodem(bytes: Uint8Array): number {\n let crc = 0;\n for (const byte of bytes) {\n crc ^= byte << 8;\n for (let i = 0; i < 8; i++) {\n crc = crc & 0x8000 ? ((crc << 1) ^ 0x1021) & 0xffff : (crc << 1) & 0xffff;\n }\n }\n return crc;\n}\n\ndeclare const canonicalHashBrand: unique symbol;\n\nexport type CanonicalHash = string & { readonly [canonicalHashBrand]: true };\n\nexport function normalizeHash(hash: string): CanonicalHash {\n try {\n const hex = BigInt(hash).toString(16);\n return (\"0x\" + hex.padStart(64, \"0\").toLowerCase()) as CanonicalHash;\n } catch {\n throw new Error(`Invalid hash: \"${hash}\"`);\n }\n}\n\nexport function shortenAddress(chain: Chain, address: string, chars = 4): string {\n const norm = normalizeAddress(chain, address);\n return `${norm.slice(0, chars + 2)}...${norm.slice(-chars)}`;\n}\n","import { validateAndParseAddress } from \"starknet\";\nimport { normalizeAddress } from \"../utils/address.js\";\nimport type { ReceiptProviderLike } from \"./types.js\";\n\nexport function normalizeWalletAddress(address: string): string {\n return normalizeAddress(\"STARKNET\", address);\n}\n\nexport function isValidStarknetAddress(address: string): boolean {\n try {\n validateAndParseAddress(address.trim());\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function isDeployed(provider: ReceiptProviderLike, address: string): Promise<boolean> {\n try {\n await provider.getClassHashAt(normalizeWalletAddress(address));\n return true;\n } catch {\n return false;\n }\n}\n","import type { Call } from \"starknet\";\n\nexport interface SelfFundFeeEstimate {\n feeRaw: bigint;\n unit: string;\n}\n\nexport type SelfFundConsentHandler = (\n feeEstimate: Promise<SelfFundFeeEstimate | null>,\n) => Promise<boolean>;\n\nexport interface SelfFundConsent {\n registerHandler(handler: SelfFundConsentHandler | null): void;\n request(input: { address?: string; calls?: Call[] }): Promise<boolean>;\n}\n\nexport function createSelfFundConsent(\n estimateFee: (address: string, calls: Call[]) => Promise<SelfFundFeeEstimate>,\n): SelfFundConsent {\n let handler: SelfFundConsentHandler | null = null;\n return {\n registerHandler(next) {\n handler = next;\n },\n async request({ address, calls }) {\n if (!handler) return false;\n const feeEstimate =\n address && calls ? estimateFee(address, calls).catch(() => null) : Promise.resolve(null);\n return handler(feeEstimate);\n },\n };\n}\n","import { ec, num } from \"starknet\";\n\nexport async function deriveAesKey(prfSecret: Uint8Array, hkdfInfo: Uint8Array): Promise<CryptoKey> {\n const hkdf = await crypto.subtle.importKey(\"raw\", prfSecret as BufferSource, \"HKDF\", false, [\"deriveKey\"]);\n return crypto.subtle.deriveKey(\n { name: \"HKDF\", hash: \"SHA-256\", salt: new Uint8Array(0), info: hkdfInfo as BufferSource },\n hkdf,\n { name: \"AES-GCM\", length: 256 },\n false,\n [\"encrypt\", \"decrypt\"],\n );\n}\n\nexport function generateStarkKeyPair(): { privateKeyHex: string; publicKeyHex: string } {\n const privateKeyHex =\n \"0x\" +\n Array.from(ec.starkCurve.utils.randomPrivateKey())\n .map((b) => b.toString(16).padStart(2, \"0\"))\n .join(\"\");\n return { privateKeyHex, publicKeyHex: ec.starkCurve.getStarkKey(privateKeyHex) };\n}\n\nexport class InvalidStarkPrivateKeyError extends Error {\n constructor(reason: string) {\n super(`Not a valid Starknet private key: ${reason}`);\n this.name = \"InvalidStarkPrivateKeyError\";\n }\n}\n\nexport function starkKeyPairFromPrivateKey(input: string): { privateKeyHex: string; publicKeyHex: string } {\n const trimmed = input.trim().replace(/\\s+/g, \"\");\n const body = trimmed.startsWith(\"0x\") || trimmed.startsWith(\"0X\") ? trimmed.slice(2) : trimmed;\n\n if (body.length === 0) throw new InvalidStarkPrivateKeyError(\"it is empty\");\n if (!/^[0-9a-fA-F]+$/.test(body)) throw new InvalidStarkPrivateKeyError(\"it is not hexadecimal\");\n if (body.length > 64) throw new InvalidStarkPrivateKeyError(\"it is too long\");\n\n const value = BigInt(\"0x\" + body);\n if (value === 0n) throw new InvalidStarkPrivateKeyError(\"it is zero\");\n if (value >= ec.starkCurve.CURVE.n) throw new InvalidStarkPrivateKeyError(\"it is outside the curve order\");\n\n const privateKeyHex = \"0x\" + value.toString(16).padStart(64, \"0\");\n return { privateKeyHex, publicKeyHex: ec.starkCurve.getStarkKey(privateKeyHex) };\n}\n\nexport async function sealPrivateKey(\n aesKey: CryptoKey,\n iv: Uint8Array,\n privateKeyHex: string,\n): Promise<ArrayBuffer> {\n return crypto.subtle.encrypt(\n { name: \"AES-GCM\", iv: iv as BufferSource },\n aesKey,\n new TextEncoder().encode(privateKeyHex),\n );\n}\n\nexport async function unsealPrivateKey(\n aesKey: CryptoKey,\n iv: Uint8Array,\n ciphertext: BufferSource,\n): Promise<string> {\n const buf = await crypto.subtle.decrypt({ name: \"AES-GCM\", iv: iv as BufferSource }, aesKey, ciphertext);\n return new TextDecoder().decode(buf);\n}\n\nexport function signWithPrivateKey(privateKeyHex: string, msgHash: string): [string, string] {\n const sig = ec.starkCurve.sign(msgHash, privateKeyHex);\n return [num.toHex(sig.r), num.toHex(sig.s)];\n}\n","import {\n deriveAesKey,\n generateStarkKeyPair,\n sealPrivateKey,\n starkKeyPairFromPrivateKey,\n unsealPrivateKey,\n} from \"../starknet/passkey-wallet/crypto.js\";\nimport { computeAccountAddress } from \"../starknet/business-provisioning/account.js\";\nimport type { SealedOwner } from \"./types.js\";\n\nexport class PasskeyCancelledError extends Error {\n constructor(message = \"Passkey prompt was cancelled.\") {\n super(message);\n this.name = \"PasskeyCancelledError\";\n }\n}\n\nexport interface PasskeyConfig {\n appName: string;\n relyingPartyName: string;\n relyingPartyId: () => string;\n prfSalt: Uint8Array<ArrayBuffer>;\n hkdfInfo: Uint8Array<ArrayBuffer>;\n passkeyUser: () => Promise<PublicKeyCredentialUserEntity>;\n knownCredentials: () => PublicKeyCredentialDescriptor[];\n credentials?: CredentialsContainer;\n randomBytes?: (length: number) => Uint8Array<ArrayBuffer>;\n}\n\nexport interface CreatedOwner {\n sealed: SealedOwner;\n privateKeyHex: string;\n}\n\nexport interface PasskeyOwner {\n createOwnerKey(): Promise<CreatedOwner>;\n unlockOwnerKey(sealed: SealedOwner): Promise<string>;\n sealImportedOwnerKey(privateKeyInput: string): Promise<SealedOwner>;\n walletAddressForPrivateKey(privateKeyInput: string): string;\n}\n\ninterface Registration {\n credentialId: string;\n prfFirst: ArrayBuffer | null;\n}\n\nconst encodeBase64 = (buf: ArrayBuffer | Uint8Array): string => {\n const bytes = buf instanceof Uint8Array ? buf : new Uint8Array(buf);\n let binary = \"\";\n for (const byte of bytes) binary += String.fromCharCode(byte);\n return btoa(binary);\n};\n\nconst decodeBase64 = (value: string): Uint8Array<ArrayBuffer> => {\n const binary = atob(value);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);\n return bytes;\n};\n\nfunction isPasskeyCancellation(err: unknown): boolean {\n const name = (err as { name?: string } | null)?.name;\n return name === \"NotAllowedError\" || name === \"AbortError\";\n}\n\nexport function createPasskeyOwner(config: PasskeyConfig): PasskeyOwner {\n const randomBytes: (length: number) => Uint8Array<ArrayBuffer> =\n config.randomBytes ?? ((length: number) => crypto.getRandomValues(new Uint8Array(length)));\n const credentialsApi = (): CredentialsContainer => {\n const api = config.credentials ?? (typeof navigator === \"undefined\" ? undefined : navigator.credentials);\n if (!api) throw new Error(\"Passkeys are only available in a browser.\");\n return api;\n };\n\n const prfUnsupportedMessage = (): string => {\n const isBrave = typeof navigator !== \"undefined\" && \"brave\" in navigator;\n const cause = isBrave\n ? \"Brave doesn't currently support the WebAuthn PRF extension.\"\n : \"This browser didn't return a passkey PRF secret.\";\n return (\n `${cause} ${config.appName} needs it to seal your key. Your device passkey (Touch ID) is fine, ` +\n \"the limitation is the browser. Please open this in Safari or Chrome on an up-to-date OS.\"\n );\n };\n\n async function registerPasskey(): Promise<Registration> {\n let credential: PublicKeyCredential;\n try {\n credential = (await credentialsApi().create({\n publicKey: {\n challenge: randomBytes(32),\n rp: { name: config.relyingPartyName, id: config.relyingPartyId() },\n user: await config.passkeyUser(),\n excludeCredentials: config.knownCredentials(),\n pubKeyCredParams: [\n { type: \"public-key\", alg: -7 },\n { type: \"public-key\", alg: -257 },\n ],\n authenticatorSelection: {\n residentKey: \"required\",\n userVerification: \"required\",\n authenticatorAttachment: \"platform\",\n },\n extensions: { prf: { eval: { first: config.prfSalt } } } as AuthenticationExtensionsClientInputs,\n },\n })) as PublicKeyCredential;\n } catch (err) {\n if (isPasskeyCancellation(err)) throw new PasskeyCancelledError();\n throw err;\n }\n const prf = (\n credential.getClientExtensionResults() as {\n prf?: { enabled?: boolean; results?: { first?: ArrayBuffer } };\n }\n ).prf;\n return { credentialId: encodeBase64(credential.rawId), prfFirst: prf?.results?.first ?? null };\n }\n\n async function prfSecret(credentialId: string): Promise<Uint8Array<ArrayBuffer>> {\n let assertion: PublicKeyCredential;\n try {\n assertion = (await credentialsApi().get({\n publicKey: {\n challenge: randomBytes(32),\n rpId: config.relyingPartyId(),\n allowCredentials: [{ type: \"public-key\", id: decodeBase64(credentialId) }],\n userVerification: \"required\",\n extensions: { prf: { eval: { first: config.prfSalt } } } as AuthenticationExtensionsClientInputs,\n },\n })) as PublicKeyCredential;\n } catch (err) {\n if (isPasskeyCancellation(err)) throw new PasskeyCancelledError();\n throw err;\n }\n const result = (assertion.getClientExtensionResults() as { prf?: { results?: { first?: ArrayBuffer } } }).prf\n ?.results?.first;\n if (!result) throw new Error(\"Passkey PRF unavailable on this device/browser.\");\n return new Uint8Array(result);\n }\n\n async function secretFromRegistration(registration: Registration): Promise<Uint8Array<ArrayBuffer>> {\n if (registration.prfFirst) return new Uint8Array(registration.prfFirst);\n try {\n return await prfSecret(registration.credentialId);\n } catch {\n throw new Error(prfUnsupportedMessage());\n }\n }\n\n async function seal(secret: Uint8Array<ArrayBuffer>, privateKeyHex: string): Promise<{ iv: string; ciphertext: string }> {\n const aes = await deriveAesKey(secret, config.hkdfInfo);\n const iv = randomBytes(12);\n const ciphertext = await sealPrivateKey(aes, iv, privateKeyHex);\n return { iv: encodeBase64(iv), ciphertext: encodeBase64(ciphertext) };\n }\n\n return {\n async createOwnerKey() {\n const registration = await registerPasskey();\n const secret = await secretFromRegistration(registration);\n const { privateKeyHex, publicKeyHex } = generateStarkKeyPair();\n const { iv, ciphertext } = await seal(secret, privateKeyHex);\n return {\n sealed: {\n credentialId: registration.credentialId,\n ownerPubKey: publicKeyHex,\n address: computeAccountAddress(publicKeyHex, 0),\n iv,\n ciphertext,\n },\n privateKeyHex,\n };\n },\n\n async unlockOwnerKey(sealed) {\n const secret = await prfSecret(sealed.credentialId);\n const aes = await deriveAesKey(secret, config.hkdfInfo);\n return unsealPrivateKey(aes, decodeBase64(sealed.iv), decodeBase64(sealed.ciphertext));\n },\n\n async sealImportedOwnerKey(privateKeyInput) {\n const { privateKeyHex, publicKeyHex } = starkKeyPairFromPrivateKey(privateKeyInput);\n const registration = await registerPasskey();\n const secret = await secretFromRegistration(registration);\n const { iv, ciphertext } = await seal(secret, privateKeyHex);\n return {\n credentialId: registration.credentialId,\n ownerPubKey: publicKeyHex,\n address: computeAccountAddress(publicKeyHex, 0),\n iv,\n ciphertext,\n };\n },\n\n walletAddressForPrivateKey(privateKeyInput) {\n return computeAccountAddress(starkKeyPairFromPrivateKey(privateKeyInput).publicKeyHex, 0);\n },\n };\n}\n","import type { Call, TypedData } from \"starknet\";\n\nexport interface TypedDataSigner {\n address: string;\n signTypedData(typedData: TypedData): Promise<string[]>;\n}\n\nexport interface SponsoredExecuteConfig {\n proxyUrl: string;\n fetchImpl?: typeof fetch;\n}\n\nexport type SponsoredExecuteResult =\n | { status: \"sponsored\"; transactionHash: string }\n | { status: \"unavailable\"; reason: string };\n\nexport class SponsoredCallRejectedError extends Error {}\n\nexport type SponsorshipFailureCode =\n | \"sponsor_unavailable\"\n | \"credits_exhausted\"\n | \"account_not_deployed\"\n | \"not_executable\"\n | \"invalid_request\"\n | \"not_eligible\"\n | \"not_authorized\"\n | \"rate_limited\"\n | \"may_have_broadcast\";\n\nconst USER_MAY_PAY: ReadonlySet<string> = new Set([\"sponsor_unavailable\", \"credits_exhausted\"]);\n\nexport function userMayPayInstead(code: string | undefined, status: number, stage: \"build\" | \"execute\"): boolean {\n if (code) return USER_MAY_PAY.has(code);\n return stage === \"build\" ? status >= 500 : status === 503;\n}\n\nasync function failureOf(res: Response, fallback: string): Promise<{ reason: string; code?: string }> {\n const body = (await res.json().catch(() => null)) as { error?: string; code?: string } | null;\n return { reason: body?.error || fallback, code: typeof body?.code === \"string\" ? body.code : undefined };\n}\n\nexport async function executeSponsored(\n config: SponsoredExecuteConfig,\n signer: TypedDataSigner,\n calls: Call[],\n): Promise<SponsoredExecuteResult> {\n const doFetch = config.fetchImpl ?? fetch;\n const base = config.proxyUrl.replace(/\\/$/, \"\");\n\n const buildRes = await doFetch(`${base}/build`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ userAddress: signer.address, calls }),\n });\n if (!buildRes.ok) {\n const { reason, code } = await failureOf(buildRes, \"We couldn't prepare this transaction.\");\n if (userMayPayInstead(code, buildRes.status, \"build\")) return { status: \"unavailable\", reason };\n throw new SponsoredCallRejectedError(reason);\n }\n const { typedData } = (await buildRes.json()) as { typedData: TypedData };\n\n const signature = await signer.signTypedData(typedData);\n\n const executeRes = await doFetch(`${base}/execute`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ userAddress: signer.address, typedData, signature, calls }),\n });\n if (!executeRes.ok) {\n const { reason, code } = await failureOf(executeRes, \"We couldn't submit this transaction.\");\n if (userMayPayInstead(code, executeRes.status, \"execute\")) {\n return { status: \"unavailable\", reason };\n }\n throw new SponsoredCallRejectedError(reason);\n }\n const { transactionHash } = (await executeRes.json()) as { transactionHash: string };\n return { status: \"sponsored\", transactionHash };\n}\n","import { Account, typedData as starknetTypedData, type Call, type ProviderInterface } from \"starknet\";\nimport { signWithPrivateKey } from \"../starknet/passkey-wallet/crypto.js\";\nimport { executeSponsored, SponsoredCallRejectedError } from \"../starknet/services/sponsoredExecutor.js\";\nimport type { SelfFundConsent, SelfFundFeeEstimate } from \"./self-fund-consent.js\";\nimport type { ExecutedTransaction, WalletExecutor } from \"./types.js\";\n\nexport interface SelfFundedDeps {\n provider: () => ProviderInterface;\n}\n\nexport function accountFor(\n provider: ProviderInterface,\n address: string,\n privateKeyHex: string,\n): Account {\n return new Account({ provider, address, signer: privateKeyHex, cairoVersion: \"1\" });\n}\n\nexport async function estimateSelfFundedFee(\n provider: ProviderInterface,\n address: string,\n calls: Call[],\n): Promise<SelfFundFeeEstimate> {\n const account = new Account({ provider, address, signer: \"0x1\", cairoVersion: \"1\" });\n const estimate = await account.estimateInvokeFee(calls);\n return { feeRaw: estimate.overall_fee, unit: estimate.unit };\n}\n\nexport function selfFundedExecutor(deps: SelfFundedDeps): WalletExecutor {\n return {\n async execute({ userAddress, privateKeyHex, calls }): Promise<ExecutedTransaction> {\n const account = accountFor(deps.provider(), userAddress, privateKeyHex);\n const { transaction_hash } = await account.execute(calls);\n return { transactionHash: transaction_hash };\n },\n };\n}\n\nexport interface SponsoredDeps extends SelfFundedDeps {\n proxyUrl: string;\n consent: SelfFundConsent;\n fetchImpl?: typeof fetch;\n fallback?: WalletExecutor;\n}\n\nexport function sponsoredExecutor(deps: SponsoredDeps): WalletExecutor {\n const fallback = deps.fallback ?? selfFundedExecutor(deps);\n return {\n async execute(input): Promise<ExecutedTransaction> {\n const { userAddress, privateKeyHex, calls } = input;\n const result = await executeSponsored(\n { proxyUrl: deps.proxyUrl, fetchImpl: deps.fetchImpl },\n {\n address: userAddress,\n signTypedData: async (data) =>\n signWithPrivateKey(privateKeyHex, starknetTypedData.getMessageHash(data, userAddress)),\n },\n calls,\n );\n if (result.status === \"sponsored\") return { transactionHash: result.transactionHash };\n\n const consented = await deps.consent.request({ address: userAddress, calls });\n if (!consented) throw new SponsoredCallRejectedError(result.reason);\n return fallback.execute(input);\n },\n };\n}\n","import { num, type Call, type ProviderInterface } from \"starknet\";\nimport { normalizeAddress } from \"../../utils/address.js\";\n\nconst norm = (address: string): string => normalizeAddress(\"STARKNET\", address);\n\nconst SIGNER_TYPE_NAMES = [\"Starknet\", \"Secp256k1\", \"Secp256r1\"] as const;\ntype SignerTypeName = (typeof SIGNER_TYPE_NAMES)[number];\n\nexport interface GuardianInfo {\n type: SignerTypeName;\n guid: string;\n storedValue: string;\n}\n\nfunction encodeFeltArray(items: string[]): string[] {\n return [num.toHex(items.length), ...items];\n}\n\nfunction encodeStarknetSigner(pubkey: string): string[] {\n return [\"0x0\", num.toHex(pubkey)];\n}\n\nfunction encodeStarknetSignerArray(pubkeys: string[]): string[] {\n return [num.toHex(pubkeys.length), ...pubkeys.flatMap(encodeStarknetSigner)];\n}\n\nexport function buildSetFirstGuardianCall(address: string, guardianPubkey: string): Call {\n return {\n contractAddress: norm(address),\n entrypoint: \"change_guardians\",\n calldata: [...encodeFeltArray([]), ...encodeStarknetSignerArray([guardianPubkey])],\n };\n}\n\nexport function buildTriggerEscapeOwnerCall(targetAddress: string, newOwnerPubkey: string): Call {\n return {\n contractAddress: norm(targetAddress),\n entrypoint: \"trigger_escape_owner\",\n calldata: encodeStarknetSigner(newOwnerPubkey),\n };\n}\n\nexport function buildCompleteEscapeOwnerCall(targetAddress: string): Call {\n return { contractAddress: norm(targetAddress), entrypoint: \"escape_owner\", calldata: [] };\n}\n\nexport function buildCancelEscapeCall(address: string): Call {\n return { contractAddress: norm(address), entrypoint: \"cancel_escape\", calldata: [] };\n}\n\nexport function decodeGuardiansInfo(res: string[]): GuardianInfo[] {\n const len = Number(res[0]);\n const out: GuardianInfo[] = [];\n for (let i = 0; i < len; i++) {\n const base = 1 + i * 3;\n out.push({\n type: SIGNER_TYPE_NAMES[Number(res[base])] ?? \"Starknet\",\n guid: res[base + 1],\n storedValue: res[base + 2],\n });\n }\n return out;\n}\n\nexport type EscapeTypeName = \"None\" | \"Guardian\" | \"Owner\";\nexport type EscapeStatusName = \"None\" | \"NotReady\" | \"Ready\" | \"Expired\";\nconst ESCAPE_TYPE_NAMES: EscapeTypeName[] = [\"None\", \"Guardian\", \"Owner\"];\nconst ESCAPE_STATUS_NAMES: EscapeStatusName[] = [\"None\", \"NotReady\", \"Ready\", \"Expired\"];\n\nexport interface EscapeInfo {\n readyAt: number;\n escapeType: EscapeTypeName;\n status: EscapeStatusName;\n}\n\nexport function decodeEscapeAndStatus(res: string[]): EscapeInfo {\n\n const readyAt = Number(res[0]);\n const escapeType = ESCAPE_TYPE_NAMES[Number(res[1])] ?? \"None\";\n const optionTag = Number(res[2]);\n const statusIndex = optionTag === 0 ? 5 : 3;\n const status = ESCAPE_STATUS_NAMES[Number(res[statusIndex])] ?? \"None\";\n return { readyAt, escapeType, status };\n}\n\nexport async function getGuardians(provider: ProviderInterface, address: string): Promise<GuardianInfo[]> {\n const res = await provider.callContract({\n contractAddress: norm(address),\n entrypoint: \"get_guardians_info\",\n calldata: [],\n });\n return decodeGuardiansInfo(res as unknown as string[]);\n}\n\nexport async function getOwners(provider: ProviderInterface, address: string): Promise<GuardianInfo[]> {\n const res = await provider.callContract({\n contractAddress: norm(address),\n entrypoint: \"get_owners_info\",\n calldata: [],\n });\n return decodeGuardiansInfo(res as unknown as string[]);\n}\n\nexport async function getEscape(provider: ProviderInterface, address: string): Promise<EscapeInfo> {\n const res = await provider.callContract({\n contractAddress: norm(address),\n entrypoint: \"get_escape_and_status\",\n calldata: [],\n });\n return decodeEscapeAndStatus(res as unknown as string[]);\n}\n\nexport async function getEscapeSecurityPeriod(provider: ProviderInterface, address: string): Promise<number> {\n const res = await provider.callContract({\n contractAddress: norm(address),\n entrypoint: \"get_escape_security_period\",\n calldata: [],\n });\n return Number((res as unknown as string[])[0]);\n}\n","import { hash, num, type BigNumberish, type Call, type TypedData } from \"starknet\";\n\nconst STARKNET_SIGNER_TYPE = \"0x537461726b6e6574205369676e6572\";\nconst OPTION_NONE = \"0x1\";\nconst OPTION_SOME = \"0x0\";\nconst SIGNER_STARKNET = \"0x0\";\n\nexport function computeOwnerGuid(ownerPubkey: BigNumberish): string {\n return hash.computePoseidonHash(STARKNET_SIGNER_TYPE, num.toHex(ownerPubkey));\n}\n\nfunction changeOwners(\n accountAddress: string,\n guidsToRemove: string[],\n pubkeysToAdd: BigNumberish[],\n ownerAlive?: OwnerAliveProof,\n): Call {\n return {\n contractAddress: accountAddress,\n entrypoint: \"change_owners\",\n calldata: [\n num.toHex(guidsToRemove.length),\n ...guidsToRemove,\n num.toHex(pubkeysToAdd.length),\n ...pubkeysToAdd.flatMap((p) => [SIGNER_STARKNET, num.toHex(p)]),\n ...(ownerAlive ? ownerAliveCalldata(ownerAlive) : [OPTION_NONE]),\n ],\n };\n}\n\nexport interface OwnerAliveProof {\n newOwnerPubkey: BigNumberish;\n signature: string[];\n expiration: number;\n}\n\nexport function ownerAliveTypedData(\n newOwnerGuid: string,\n expiration: number,\n chainId: string,\n): TypedData {\n return {\n types: {\n StarknetDomain: [\n { name: \"name\", type: \"shortstring\" },\n { name: \"version\", type: \"shortstring\" },\n { name: \"chainId\", type: \"shortstring\" },\n { name: \"revision\", type: \"shortstring\" },\n ],\n \"Owner Alive\": [\n { name: \"Owner GUID\", type: \"felt\" },\n { name: \"Signature expiration\", type: \"timestamp\" },\n ],\n },\n primaryType: \"Owner Alive\",\n domain: { name: \"Owner Alive\", version: \"1\", chainId, revision: \"1\" },\n message: { \"Owner GUID\": newOwnerGuid, \"Signature expiration\": expiration },\n };\n}\n\nfunction ownerAliveCalldata(proof: OwnerAliveProof): string[] {\n if (proof.signature.length !== 2) {\n throw new Error(\"owner-alive proof needs an r and s from the incoming owner\");\n }\n return [\n OPTION_SOME,\n SIGNER_STARKNET,\n num.toHex(proof.newOwnerPubkey),\n num.toHex(proof.signature[0]),\n num.toHex(proof.signature[1]),\n num.toHex(proof.expiration),\n ];\n}\n\nexport function buildChangeOwnersCall(\n accountAddress: string,\n removeOwnerPubkey: BigNumberish,\n addOwnerPubkey: BigNumberish,\n ownerAlive?: OwnerAliveProof,\n): Call {\n if (!ownerAlive) {\n throw new Error(\n \"Handing an account over removes the signing owner, so the account requires an owner-alive proof from the incoming owner. Sign ownerAliveTypedData with the new owner key and pass it here.\",\n );\n }\n return changeOwners(\n accountAddress,\n [computeOwnerGuid(removeOwnerPubkey)],\n [addOwnerPubkey],\n ownerAlive,\n );\n}\n\nexport function buildAddOwnerCall(accountAddress: string, addOwnerPubkey: BigNumberish): Call {\n return changeOwners(accountAddress, [], [addOwnerPubkey]);\n}\n\nexport function buildRemoveOwnerCall(accountAddress: string, removeOwnerPubkey: BigNumberish): Call {\n return changeOwners(accountAddress, [computeOwnerGuid(removeOwnerPubkey)], []);\n}\n\nexport function buildRemoveOwnerByGuidCall(accountAddress: string, ownerGuid: BigNumberish): Call {\n return changeOwners(accountAddress, [num.toHex(ownerGuid)], []);\n}\n","import { typedData as starknetTypedData, type Call, type ProviderInterface, type TypedData } from \"starknet\";\nimport { signWithPrivateKey } from \"../starknet/passkey-wallet/crypto.js\";\nimport {\n buildCancelEscapeCall,\n buildCompleteEscapeOwnerCall,\n buildSetFirstGuardianCall,\n buildTriggerEscapeOwnerCall,\n getEscape,\n getEscapeSecurityPeriod,\n getGuardians,\n getOwners,\n type EscapeInfo,\n type GuardianInfo,\n} from \"../starknet/business-provisioning/guardian.js\";\nimport {\n buildAddOwnerCall,\n buildRemoveOwnerByGuidCall,\n computeOwnerGuid,\n} from \"../starknet/business-provisioning/handoff.js\";\nimport { normalizeWalletAddress } from \"./addresses.js\";\nimport type { OwnerStore } from \"./store.js\";\nimport type { PasskeyOwner } from \"./passkey.js\";\nimport type { ExecutedTransaction, SealedOwner, WalletExecutor } from \"./types.js\";\n\nexport interface DeviceEntry {\n guid: string;\n type: GuardianInfo[\"type\"];\n isThisDevice: boolean;\n}\n\nexport function describeDevices(owners: GuardianInfo[], thisDevicePubkey: string): DeviceEntry[] {\n const mine = computeOwnerGuid(thisDevicePubkey);\n return owners.map((owner) => ({\n guid: owner.guid,\n type: owner.type,\n isThisDevice: BigInt(owner.guid) === BigInt(mine),\n }));\n}\n\nexport function canRemoveDevice(devices: DeviceEntry[], guid: string): boolean {\n if (devices.length <= 1) return false;\n return devices.some((device) => BigInt(device.guid) === BigInt(guid));\n}\n\nexport interface MediaWalletConfig {\n store: OwnerStore;\n passkey: PasskeyOwner;\n executor: WalletExecutor;\n provider: () => ProviderInterface;\n unlockTtlMs?: number;\n}\n\nexport interface MediaWallet {\n store: OwnerStore;\n passkey: PasskeyOwner;\n lock(address: string): void;\n signerFor(sealed: SealedOwner): {\n address: string;\n signTypedData(data: TypedData): Promise<string[]>;\n execute(calls: Call[]): Promise<{ txHash: string }>;\n };\n run(sealed: SealedOwner, calls: Call[], userAddress?: string): Promise<ExecutedTransaction>;\n getGuardians(address: string): Promise<GuardianInfo[]>;\n getEscape(address: string): Promise<EscapeInfo>;\n getEscapeSecurityPeriod(address: string): Promise<number>;\n setFirstGuardian(sealed: SealedOwner, guardianPubkey: string): Promise<string>;\n triggerEscapeOwner(guardianSealed: SealedOwner, targetAddress: string, newOwnerPubkey: string): Promise<string>;\n completeEscapeOwner(guardianSealed: SealedOwner, targetAddress: string): Promise<string>;\n cancelEscape(sealed: SealedOwner): Promise<string>;\n getOwners(address: string): Promise<GuardianInfo[]>;\n isOwnerOf(accountAddress: string, devicePubkey: string): Promise<boolean>;\n addDevice(sealed: SealedOwner, devicePubkey: string): Promise<string>;\n removeDevice(sealed: SealedOwner, ownerGuid: string): Promise<string>;\n}\n\nexport function createMediaWallet(config: MediaWalletConfig): MediaWallet {\n const ttl = config.unlockTtlMs ?? 20_000;\n const unlockCache = new Map<string, { promise: Promise<string>; timer: ReturnType<typeof setTimeout> }>();\n\n const lock = (address: string): void => {\n const entry = unlockCache.get(address);\n if (!entry) return;\n clearTimeout(entry.timer);\n unlockCache.delete(address);\n };\n\n const unlockOnce = (sealed: SealedOwner): Promise<string> => {\n const existing = unlockCache.get(sealed.address);\n if (existing) return existing.promise;\n const promise = config.passkey.unlockOwnerKey(sealed).catch((err) => {\n lock(sealed.address);\n throw err;\n });\n const timer = setTimeout(() => lock(sealed.address), ttl);\n unlockCache.set(sealed.address, { promise, timer });\n return promise;\n };\n\n const run = async (sealed: SealedOwner, calls: Call[], userAddress?: string): Promise<ExecutedTransaction> => {\n const privateKeyHex = await unlockOnce(sealed);\n return config.executor.execute({\n userAddress: userAddress ?? sealed.address,\n privateKeyHex,\n calls,\n });\n };\n\n return {\n store: config.store,\n passkey: config.passkey,\n lock,\n\n signerFor(sealed) {\n return {\n address: sealed.address,\n signTypedData: async (data) => {\n const privateKeyHex = await unlockOnce(sealed);\n return signWithPrivateKey(privateKeyHex, starknetTypedData.getMessageHash(data, sealed.address));\n },\n execute: async (calls) => {\n const { transactionHash } = await run(sealed, calls);\n return { txHash: transactionHash };\n },\n };\n },\n\n run,\n\n getGuardians: (address) => getGuardians(config.provider(), address),\n getEscape: (address) => getEscape(config.provider(), address),\n getEscapeSecurityPeriod: (address) => getEscapeSecurityPeriod(config.provider(), address),\n getOwners: (address) => getOwners(config.provider(), address),\n\n async isOwnerOf(accountAddress, devicePubkey) {\n const owners = await getOwners(config.provider(), accountAddress);\n const guid = BigInt(computeOwnerGuid(devicePubkey));\n return owners.some((owner) => BigInt(owner.guid) === guid);\n },\n\n async setFirstGuardian(sealed, guardianPubkey) {\n const { transactionHash } = await run(sealed, [buildSetFirstGuardianCall(sealed.address, guardianPubkey)]);\n return transactionHash;\n },\n\n async triggerEscapeOwner(guardianSealed, targetAddress, newOwnerPubkey) {\n const { transactionHash } = await run(\n guardianSealed,\n [buildTriggerEscapeOwnerCall(targetAddress, newOwnerPubkey)],\n normalizeWalletAddress(targetAddress),\n );\n return transactionHash;\n },\n\n async completeEscapeOwner(guardianSealed, targetAddress) {\n const { transactionHash } = await run(\n guardianSealed,\n [buildCompleteEscapeOwnerCall(targetAddress)],\n normalizeWalletAddress(targetAddress),\n );\n return transactionHash;\n },\n\n async cancelEscape(sealed) {\n const { transactionHash } = await run(sealed, [buildCancelEscapeCall(sealed.address)]);\n return transactionHash;\n },\n\n async addDevice(sealed, devicePubkey) {\n const { transactionHash } = await run(sealed, [buildAddOwnerCall(sealed.address, devicePubkey)]);\n return transactionHash;\n },\n\n async removeDevice(sealed, ownerGuid) {\n const { transactionHash } = await run(sealed, [buildRemoveOwnerByGuidCall(sealed.address, ownerGuid)]);\n return transactionHash;\n },\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@medialane/sdk",
3
- "version": "0.119.2",
3
+ "version": "0.120.0",
4
4
  "description": "Framework-agnostic TypeScript SDK for Medialane.io — the IP marketplace on Starknet",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -31,6 +31,11 @@
31
31
  "types": "./dist/stellar/index.d.ts",
32
32
  "import": "./dist/stellar/index.js",
33
33
  "require": "./dist/stellar/index.cjs"
34
+ },
35
+ "./wallet": {
36
+ "types": "./dist/wallet/index.d.ts",
37
+ "import": "./dist/wallet/index.js",
38
+ "require": "./dist/wallet/index.cjs"
34
39
  }
35
40
  },
36
41
  "license": "MIT",