@chipi-stack/chipi-react 14.9.0 → 14.10.1

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/dist/index.js CHANGED
@@ -10736,6 +10736,7 @@ var OutsideExecutionTypesV2 = {
10736
10736
  ]
10737
10737
  };
10738
10738
  var OutsideExecutionVersion = {
10739
+ UNSUPPORTED: "0",
10739
10740
  V1: "1",
10740
10741
  V2: "2"
10741
10742
  };
@@ -18627,9 +18628,76 @@ var BrotherId = class _BrotherId {
18627
18628
  }
18628
18629
  }
18629
18630
  };
18630
- (class extends Mixin(RpcProvider, StarknetId, BrotherId) {
18631
- });
18631
+ var RpcProvider2 = class extends Mixin(RpcProvider, StarknetId, BrotherId) {
18632
+ };
18632
18633
  new RpcProvider({ default: true });
18634
+ var Signer = class {
18635
+ constructor(pk = utils.randomPrivateKey()) {
18636
+ __publicField(this, "pk");
18637
+ this.pk = pk instanceof Uint8Array ? buf2hex(pk) : toHex(pk);
18638
+ }
18639
+ async getPubKey() {
18640
+ return getStarkKey(this.pk);
18641
+ }
18642
+ async signMessage(typedData, accountAddress) {
18643
+ const msgHash = getMessageHash(typedData, accountAddress);
18644
+ return this.signRaw(msgHash);
18645
+ }
18646
+ async signTransaction(transactions, details) {
18647
+ const compiledCalldata = getExecuteCalldata(transactions, details.cairoVersion);
18648
+ let msgHash;
18649
+ if (Object.values(api_exports3.ETransactionVersion3).includes(details.version)) {
18650
+ const det = details;
18651
+ msgHash = calculateInvokeTransactionHash2({
18652
+ ...det,
18653
+ senderAddress: det.walletAddress,
18654
+ compiledCalldata,
18655
+ version: det.version,
18656
+ nonceDataAvailabilityMode: intDAM(det.nonceDataAvailabilityMode),
18657
+ feeDataAvailabilityMode: intDAM(det.feeDataAvailabilityMode)
18658
+ });
18659
+ } else {
18660
+ throw Error("unsupported signTransaction version");
18661
+ }
18662
+ return this.signRaw(msgHash);
18663
+ }
18664
+ async signDeployAccountTransaction(details) {
18665
+ const compiledConstructorCalldata = CallData.compile(details.constructorCalldata);
18666
+ let msgHash;
18667
+ if (Object.values(api_exports3.ETransactionVersion3).includes(details.version)) {
18668
+ const det = details;
18669
+ msgHash = calculateDeployAccountTransactionHash3({
18670
+ ...det,
18671
+ salt: det.addressSalt,
18672
+ compiledConstructorCalldata,
18673
+ version: det.version,
18674
+ nonceDataAvailabilityMode: intDAM(det.nonceDataAvailabilityMode),
18675
+ feeDataAvailabilityMode: intDAM(det.feeDataAvailabilityMode)
18676
+ });
18677
+ } else {
18678
+ throw Error("unsupported signDeployAccountTransaction version");
18679
+ }
18680
+ return this.signRaw(msgHash);
18681
+ }
18682
+ async signDeclareTransaction(details) {
18683
+ let msgHash;
18684
+ if (Object.values(api_exports3.ETransactionVersion3).includes(details.version)) {
18685
+ const det = details;
18686
+ msgHash = calculateDeclareTransactionHash3({
18687
+ ...det,
18688
+ version: det.version,
18689
+ nonceDataAvailabilityMode: intDAM(det.nonceDataAvailabilityMode),
18690
+ feeDataAvailabilityMode: intDAM(det.feeDataAvailabilityMode)
18691
+ });
18692
+ } else {
18693
+ throw Error("unsupported signDeclareTransaction version");
18694
+ }
18695
+ return this.signRaw(msgHash);
18696
+ }
18697
+ async signRaw(msgHash) {
18698
+ return sign(msgHash, this.pk);
18699
+ }
18700
+ };
18633
18701
  var uint256_exports = {};
18634
18702
  __export2(uint256_exports, {
18635
18703
  bnToUint256: () => bnToUint256,
@@ -19074,7 +19142,7 @@ var PaymasterRpc = class _PaymasterRpc {
19074
19142
  );
19075
19143
  }
19076
19144
  };
19077
- new PaymasterRpc({ default: true });
19145
+ var defaultPaymaster = new PaymasterRpc({ default: true });
19078
19146
  var Deployer = class {
19079
19147
  constructor(address, entryPoint) {
19080
19148
  __publicField(this, "address");
@@ -19149,8 +19217,791 @@ var Deployer = class {
19149
19217
  };
19150
19218
  }
19151
19219
  };
19152
- new Deployer(UDC.ADDRESS, UDC.ENTRYPOINT);
19220
+ var defaultDeployer = new Deployer(UDC.ADDRESS, UDC.ENTRYPOINT);
19153
19221
  new Deployer(LegacyUDC.ADDRESS, LegacyUDC.ENTRYPOINT);
19222
+ var Account = class extends RpcProvider2 {
19223
+ constructor(options) {
19224
+ const {
19225
+ provider,
19226
+ address,
19227
+ signer,
19228
+ cairoVersion,
19229
+ transactionVersion,
19230
+ paymaster,
19231
+ defaultTipType
19232
+ } = options;
19233
+ super(provider);
19234
+ __publicField(this, "signer");
19235
+ __publicField(this, "address");
19236
+ __publicField(this, "cairoVersion");
19237
+ __publicField(this, "transactionVersion");
19238
+ __publicField(this, "paymaster");
19239
+ __publicField(this, "deployer");
19240
+ __publicField(this, "defaultTipType");
19241
+ __publicField(this, "deploySelf", this.deployAccount);
19242
+ this.address = address.toLowerCase();
19243
+ this.signer = isString(signer) || signer instanceof Uint8Array ? new Signer(signer) : signer;
19244
+ if (cairoVersion) {
19245
+ this.cairoVersion = cairoVersion.toString();
19246
+ }
19247
+ this.transactionVersion = transactionVersion ?? config2.get("transactionVersion");
19248
+ this.paymaster = paymaster ? new PaymasterRpc(paymaster) : defaultPaymaster;
19249
+ this.deployer = options.deployer ?? defaultDeployer;
19250
+ this.defaultTipType = defaultTipType ?? config2.get("defaultTipType");
19251
+ logger.debug("Account setup", {
19252
+ transactionVersion: this.transactionVersion,
19253
+ cairoVersion: this.cairoVersion,
19254
+ channel: this.channel.id
19255
+ });
19256
+ }
19257
+ /** @deprecated @hidden */
19258
+ // The deprecation tag is meant to discourage use, not to signal future removal
19259
+ // it should only be removed if the relationship with the corresponding Provider.create(...) method changes
19260
+ static async create() {
19261
+ throw new LibraryError("Not supported");
19262
+ }
19263
+ async getNonce(blockIdentifier) {
19264
+ return super.getNonceForAddress(this.address, blockIdentifier);
19265
+ }
19266
+ async getNonceSafe(nonce) {
19267
+ try {
19268
+ return toBigInt(nonce ?? await this.getNonce());
19269
+ } catch (error) {
19270
+ return 0n;
19271
+ }
19272
+ }
19273
+ /**
19274
+ * Retrieves the Cairo version from the network and sets `cairoVersion` if not already set in the constructor.
19275
+ * @param classHash if provided detects Cairo version from classHash, otherwise from the account address
19276
+ */
19277
+ async getCairoVersion(classHash) {
19278
+ if (!this.cairoVersion) {
19279
+ const { cairo } = classHash ? await super.getContractVersion(void 0, classHash) : await super.getContractVersion(this.address);
19280
+ this.cairoVersion = cairo;
19281
+ }
19282
+ return this.cairoVersion;
19283
+ }
19284
+ // TODO: TT Cairo version is still needed for invoke on existing contracts
19285
+ async estimateInvokeFee(calls, details = {}) {
19286
+ const invocations = [{ type: api_exports3.ETransactionType.INVOKE, payload: [calls].flat() }];
19287
+ const estimateBulk = await this.estimateFeeBulk(invocations, details);
19288
+ return estimateBulk[0];
19289
+ }
19290
+ async estimateDeclareFee(payload, details = {}) {
19291
+ assert(
19292
+ isSierra(payload.contract),
19293
+ "Declare fee estimation is not supported for Cairo0 contracts"
19294
+ );
19295
+ const invocations = [
19296
+ {
19297
+ type: api_exports3.ETransactionType.DECLARE,
19298
+ payload: extractContractHashes(payload, await this.channel.getStarknetVersion())
19299
+ }
19300
+ ];
19301
+ const estimateBulk = await this.estimateFeeBulk(invocations, details);
19302
+ return estimateBulk[0];
19303
+ }
19304
+ async estimateAccountDeployFee({
19305
+ classHash,
19306
+ addressSalt = 0,
19307
+ constructorCalldata = [],
19308
+ contractAddress
19309
+ }, details = {}) {
19310
+ const compiledCalldata = CallData.compile(constructorCalldata);
19311
+ const contractAddressFinal = contractAddress ?? calculateContractAddressFromHash(addressSalt, classHash, compiledCalldata, 0);
19312
+ const invocations = [
19313
+ {
19314
+ type: api_exports3.ETransactionType.DEPLOY_ACCOUNT,
19315
+ payload: {
19316
+ classHash,
19317
+ constructorCalldata: compiledCalldata,
19318
+ addressSalt,
19319
+ contractAddress: contractAddressFinal
19320
+ }
19321
+ }
19322
+ ];
19323
+ const estimateBulk = await this.estimateFeeBulk(invocations, details);
19324
+ return estimateBulk[0];
19325
+ }
19326
+ async estimateDeployFee(payload, details = {}) {
19327
+ const { calls } = this.deployer.buildDeployerCall(payload, this.address);
19328
+ return this.estimateInvokeFee(calls, details);
19329
+ }
19330
+ async estimateFeeBulk(invocations, details = {}) {
19331
+ if (!invocations.length) throw TypeError("Invocations should be non-empty array");
19332
+ if (details.resourceBounds)
19333
+ return [resourceBoundsToEstimateFeeResponse(details.resourceBounds)];
19334
+ const { nonce, blockIdentifier, version, skipValidate } = details;
19335
+ const detailsWithTip = await this.resolveDetailsWithTip(details);
19336
+ const accountInvocations = await this.accountInvocationsFactory(invocations, {
19337
+ ...v3Details(detailsWithTip),
19338
+ versions: [
19339
+ toTransactionVersion(
19340
+ toFeeVersion(this.transactionVersion) || ETransactionVersion33.F3,
19341
+ version
19342
+ )
19343
+ // sierra
19344
+ ],
19345
+ nonce,
19346
+ blockIdentifier,
19347
+ skipValidate
19348
+ });
19349
+ return super.getEstimateFeeBulk(accountInvocations, {
19350
+ blockIdentifier,
19351
+ skipValidate
19352
+ });
19353
+ }
19354
+ async simulateTransaction(invocations, details = {}) {
19355
+ if (!invocations.length) throw TypeError("Invocations should be non-empty array");
19356
+ const {
19357
+ nonce,
19358
+ blockIdentifier,
19359
+ skipValidate = true,
19360
+ skipExecute,
19361
+ version: providedVersion
19362
+ } = details;
19363
+ const detailsWithTip = await this.resolveDetailsWithTip(details);
19364
+ const accountInvocations = await this.accountInvocationsFactory(invocations, {
19365
+ ...v3Details(detailsWithTip),
19366
+ versions: [this.resolveTransactionVersion(providedVersion)],
19367
+ nonce,
19368
+ blockIdentifier,
19369
+ skipValidate
19370
+ });
19371
+ return super.getSimulateTransaction(accountInvocations, {
19372
+ blockIdentifier,
19373
+ skipValidate,
19374
+ skipExecute
19375
+ });
19376
+ }
19377
+ async execute(transactions, transactionsDetail = {}) {
19378
+ const calls = [transactions].flat();
19379
+ const detailsWithTip = await this.resolveDetailsWithTip(transactionsDetail);
19380
+ const { resourceBounds: providedResourceBounds } = transactionsDetail;
19381
+ let resourceBounds = providedResourceBounds;
19382
+ if (!resourceBounds) {
19383
+ const estimateResponse = await this.estimateInvokeFee(calls, detailsWithTip);
19384
+ resourceBounds = estimateResponse.resourceBounds;
19385
+ }
19386
+ const accountInvocations = await this.accountInvocationsFactory(
19387
+ [{ type: api_exports3.ETransactionType.INVOKE, payload: calls }],
19388
+ {
19389
+ ...v3Details(detailsWithTip),
19390
+ resourceBounds,
19391
+ versions: [this.resolveTransactionVersion(transactionsDetail.version)],
19392
+ nonce: transactionsDetail.nonce,
19393
+ skipValidate: false
19394
+ }
19395
+ );
19396
+ const invocation = accountInvocations[0];
19397
+ return this.invokeFunction(
19398
+ {
19399
+ contractAddress: invocation.contractAddress,
19400
+ calldata: invocation.calldata,
19401
+ signature: invocation.signature
19402
+ },
19403
+ {
19404
+ ...v3Details(detailsWithTip),
19405
+ resourceBounds: invocation.resourceBounds,
19406
+ nonce: invocation.nonce,
19407
+ version: invocation.version
19408
+ }
19409
+ );
19410
+ }
19411
+ /**
19412
+ * Execute one or multiple calls through the account contract,
19413
+ * responding as soon as a new transaction is possible with the same account.
19414
+ * Useful for gaming usage.
19415
+ * - This method requires the provider to be initialized with `pre_confirmed` blockIdentifier option.
19416
+ * - Rpc 0.9 minimum.
19417
+ * - In a normal myAccount.execute() call, followed by myProvider.waitForTransaction(), you have an immediate access to the events and to the transaction report. Here, we are processing consecutive transactions faster, but events & transaction reports are not available immediately.
19418
+ * - As a consequence of the previous point, do not use contract/account deployment with this method.
19419
+ * @param {AllowArray<Call>} transactions - Single call or array of calls to execute
19420
+ * @param {UniversalDetails} [transactionsDetail] - Transaction execution options
19421
+ * @param {fastWaitForTransactionOptions} [waitDetail={retries: 50, retryInterval: 500}] - options to scan the network for the next possible transaction. `retries` is the number of times to retry, `retryInterval` is the time in ms between retries.
19422
+ * @returns {Promise<fastExecuteResponse>} Response containing the transaction result and status for the next transaction. If `isReady` is true, you can execute the next transaction. If false, timeout has been reached before the next transaction was possible.
19423
+ * @example
19424
+ * ```typescript
19425
+ * const myProvider = new RpcProvider({ nodeUrl: url, blockIdentifier: BlockTag.PRE_CONFIRMED });
19426
+ * const myAccount = new Account({ provider: myProvider, address: accountAddress0, signer: privateKey0 });
19427
+ * const resp = await myAccount.fastExecute(
19428
+ * call, { tip: recommendedTip},
19429
+ * { retries: 30, retryInterval: 500 });
19430
+ * // if resp.isReady is true, you can launch immediately a new tx.
19431
+ * ```
19432
+ */
19433
+ async fastExecute(transactions, transactionsDetail = {}, waitDetail = {}) {
19434
+ assert(
19435
+ this.channel.blockIdentifier === BlockTag.PRE_CONFIRMED,
19436
+ "Provider needs to be initialized with `pre_confirmed` blockIdentifier option."
19437
+ );
19438
+ const initNonce = BigInt(
19439
+ transactionsDetail.nonce ?? await this.getNonceForAddress(this.address, BlockTag.PRE_CONFIRMED)
19440
+ );
19441
+ const details = { ...transactionsDetail, nonce: initNonce };
19442
+ const resultTx = await this.execute(transactions, details);
19443
+ const resultWait = await this.fastWaitForTransaction(
19444
+ resultTx.transaction_hash,
19445
+ this.address,
19446
+ initNonce,
19447
+ waitDetail
19448
+ );
19449
+ return { txResult: resultTx, isReady: resultWait };
19450
+ }
19451
+ /**
19452
+ * First check if contract is already declared, if not declare it
19453
+ * If contract already declared returned transaction_hash is ''.
19454
+ * Method will pass even if contract is already declared
19455
+ * @param transactionsDetail (optional)
19456
+ */
19457
+ async declareIfNot(payload, transactionsDetail = {}) {
19458
+ const declareContractPayload = extractContractHashes(
19459
+ payload,
19460
+ await this.channel.getStarknetVersion()
19461
+ );
19462
+ try {
19463
+ await this.getClassByHash(declareContractPayload.classHash);
19464
+ } catch (error) {
19465
+ return this.declare(payload, transactionsDetail);
19466
+ }
19467
+ return {
19468
+ transaction_hash: "",
19469
+ class_hash: declareContractPayload.classHash
19470
+ };
19471
+ }
19472
+ async declare(payload, details = {}) {
19473
+ assert(isSierra(payload.contract), SYSTEM_MESSAGES.declareNonSierra);
19474
+ const declareContractPayload = extractContractHashes(
19475
+ payload,
19476
+ await this.channel.getStarknetVersion()
19477
+ );
19478
+ const detailsWithTip = await this.resolveDetailsWithTip(details);
19479
+ const { resourceBounds: providedResourceBounds } = details;
19480
+ let resourceBounds = providedResourceBounds;
19481
+ if (!resourceBounds) {
19482
+ const estimateResponse = await this.estimateDeclareFee(payload, detailsWithTip);
19483
+ resourceBounds = estimateResponse.resourceBounds;
19484
+ }
19485
+ const accountInvocations = await this.accountInvocationsFactory(
19486
+ [{ type: api_exports3.ETransactionType.DECLARE, payload: declareContractPayload }],
19487
+ {
19488
+ ...v3Details(detailsWithTip),
19489
+ resourceBounds,
19490
+ versions: [this.resolveTransactionVersion(details.version)],
19491
+ nonce: details.nonce,
19492
+ skipValidate: false
19493
+ }
19494
+ );
19495
+ const declaration = accountInvocations[0];
19496
+ return super.declareContract(
19497
+ {
19498
+ senderAddress: declaration.senderAddress,
19499
+ signature: declaration.signature,
19500
+ contract: declaration.contract,
19501
+ compiledClassHash: declaration.compiledClassHash
19502
+ },
19503
+ {
19504
+ ...v3Details(detailsWithTip),
19505
+ nonce: declaration.nonce,
19506
+ resourceBounds: declaration.resourceBounds,
19507
+ version: declaration.version
19508
+ }
19509
+ );
19510
+ }
19511
+ async deploy(payload, details = {}) {
19512
+ const { calls, addresses } = this.deployer.buildDeployerCall(payload, this.address);
19513
+ const invokeResponse = await this.execute(calls, details);
19514
+ return {
19515
+ ...invokeResponse,
19516
+ contract_address: addresses
19517
+ };
19518
+ }
19519
+ async deployContract(payload, details = {}) {
19520
+ const deployTx = await this.deploy(payload, details);
19521
+ const txReceipt = await this.waitForTransaction(deployTx.transaction_hash, details);
19522
+ return this.deployer.parseDeployerEvent(
19523
+ txReceipt
19524
+ );
19525
+ }
19526
+ async declareAndDeploy(payload, details = {}) {
19527
+ let declare = await this.declareIfNot(payload, details);
19528
+ if (declare.transaction_hash !== "") {
19529
+ const tx = await this.waitForTransaction(declare.transaction_hash, details);
19530
+ declare = { ...declare, ...tx };
19531
+ }
19532
+ const deploy = await this.deployContract(
19533
+ { ...payload, classHash: declare.class_hash },
19534
+ details
19535
+ );
19536
+ return { declare: { ...declare }, deploy };
19537
+ }
19538
+ async deployAccount({
19539
+ classHash,
19540
+ constructorCalldata = [],
19541
+ addressSalt = 0,
19542
+ contractAddress: providedContractAddress
19543
+ }, details = {}) {
19544
+ const compiledCalldata = CallData.compile(constructorCalldata);
19545
+ const contractAddress = providedContractAddress ?? calculateContractAddressFromHash(addressSalt, classHash, compiledCalldata, 0);
19546
+ const detailsWithTip = await this.resolveDetailsWithTip(details);
19547
+ const { resourceBounds: providedResourceBounds } = details;
19548
+ let resourceBounds = providedResourceBounds;
19549
+ if (!resourceBounds) {
19550
+ const estimateResponse = await this.estimateAccountDeployFee(
19551
+ {
19552
+ classHash,
19553
+ constructorCalldata,
19554
+ addressSalt,
19555
+ contractAddress
19556
+ },
19557
+ detailsWithTip
19558
+ );
19559
+ resourceBounds = estimateResponse.resourceBounds;
19560
+ }
19561
+ const accountInvocations = await this.accountInvocationsFactory(
19562
+ [
19563
+ {
19564
+ type: api_exports3.ETransactionType.DEPLOY_ACCOUNT,
19565
+ payload: {
19566
+ classHash,
19567
+ constructorCalldata: compiledCalldata,
19568
+ addressSalt,
19569
+ contractAddress
19570
+ }
19571
+ }
19572
+ ],
19573
+ {
19574
+ ...v3Details(detailsWithTip),
19575
+ resourceBounds,
19576
+ versions: [this.resolveTransactionVersion(details.version)],
19577
+ nonce: ZERO,
19578
+ // DEPLOY_ACCOUNT always uses nonce 0
19579
+ skipValidate: false
19580
+ }
19581
+ );
19582
+ const deployment = accountInvocations[0];
19583
+ return super.deployAccountContract(
19584
+ {
19585
+ classHash: deployment.classHash,
19586
+ addressSalt: deployment.addressSalt,
19587
+ constructorCalldata: deployment.constructorCalldata,
19588
+ signature: deployment.signature
19589
+ },
19590
+ {
19591
+ ...v3Details(detailsWithTip),
19592
+ nonce: deployment.nonce,
19593
+ resourceBounds: deployment.resourceBounds,
19594
+ version: deployment.version
19595
+ }
19596
+ );
19597
+ }
19598
+ async signMessage(typedData) {
19599
+ return this.signer.signMessage(typedData, this.address);
19600
+ }
19601
+ async hashMessage(typedData) {
19602
+ return getMessageHash(typedData, this.address);
19603
+ }
19604
+ /**
19605
+ * Verify if an account is compatible with SNIP-9 outside execution, and with which version of this standard.
19606
+ * @returns {OutsideExecutionVersion} Not compatible, V1, V2.
19607
+ * @example
19608
+ * ```typescript
19609
+ * const result = myAccount.getSnip9Version();
19610
+ * // result = "V1"
19611
+ * ```
19612
+ */
19613
+ async getSnip9Version() {
19614
+ if (await supportsInterface(this, this.address, SNIP9_V2_INTERFACE_ID)) {
19615
+ return OutsideExecutionVersion.V2;
19616
+ }
19617
+ if (await supportsInterface(this, this.address, SNIP9_V1_INTERFACE_ID)) {
19618
+ return OutsideExecutionVersion.V1;
19619
+ }
19620
+ return OutsideExecutionVersion.UNSUPPORTED;
19621
+ }
19622
+ /**
19623
+ * Verify if a SNIP-9 nonce has not yet been used by the account.
19624
+ * @param {BigNumberish} nonce SNIP-9 nonce to test.
19625
+ * @returns {boolean} true if SNIP-9 nonce not yet used.
19626
+ * @example
19627
+ * ```typescript
19628
+ * const result = myAccount.isValidSnip9Nonce(1234);
19629
+ * // result = true
19630
+ * ```
19631
+ */
19632
+ async isValidSnip9Nonce(nonce) {
19633
+ try {
19634
+ const call = {
19635
+ contractAddress: this.address,
19636
+ entrypoint: "is_valid_outside_execution_nonce",
19637
+ calldata: [toHex(nonce)]
19638
+ };
19639
+ const resp = await this.callContract(call);
19640
+ return BigInt(resp[0]) !== 0n;
19641
+ } catch (error) {
19642
+ throw new Error(`Failed to check if nonce is valid: ${error}`);
19643
+ }
19644
+ }
19645
+ /**
19646
+ * Outside transaction needs a specific SNIP-9 nonce, that we get in this function.
19647
+ * A SNIP-9 nonce can be any number not yet used ; no ordering is needed.
19648
+ * @returns {string} an Hex string of a SNIP-9 nonce.
19649
+ * @example
19650
+ * ```typescript
19651
+ * const result = myAccount.getSnip9Nonce();
19652
+ * // result = "0x28a612590dbc36927933c8ee0f357eee639c8b22b3d3aa86949eed3ada4ac55"
19653
+ * ```
19654
+ */
19655
+ async getSnip9Nonce() {
19656
+ const nonce = randomAddress();
19657
+ const isValidNonce = await this.isValidSnip9Nonce(nonce);
19658
+ if (!isValidNonce) {
19659
+ return this.getSnip9Nonce();
19660
+ }
19661
+ return nonce;
19662
+ }
19663
+ /**
19664
+ * Creates an object containing transaction(s) that can be executed by an other account with` Account.executeFromOutside()`, called Outside Transaction.
19665
+ * @param {OutsideExecutionOptions} options Parameters of the transaction(s).
19666
+ * @param {AllowArray<Call>} calls Transaction(s) to execute.
19667
+ * @param {OutsideExecutionVersion} [version] SNIP-9 version of the Account that creates the outside transaction.
19668
+ * @param {BigNumberish} [nonce] Outside Nonce.
19669
+ * @returns {OutsideTransaction} and object that can be used in `Account.executeFromOutside()`
19670
+ * @example
19671
+ * ```typescript
19672
+ * const now_seconds = Math.floor(Date.now() / 1000);
19673
+ * const callOptions: OutsideExecutionOptions = {
19674
+ caller: executorAccount.address, execute_after: now_seconds - 3600, execute_before: now_seconds + 3600 };
19675
+ * const call1: Call = { contractAddress: ethAddress, entrypoint: 'transfer', calldata: {
19676
+ * recipient: recipientAccount.address, amount: cairo.uint256(100) } };
19677
+ * const outsideTransaction1: OutsideTransaction = await signerAccount.getOutsideTransaction(callOptions, call3);
19678
+ * // result = {
19679
+ * // outsideExecution: {
19680
+ * // caller: '0x64b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691',
19681
+ * // nonce: '0x28a612590dbc36927933c8ee0f357eee639c8b22b3d3aa86949eed3ada4ac55',
19682
+ * // execute_after: 1723650229, execute_before: 1723704229, calls: [[Object]] },
19683
+ * // signature: Signature {
19684
+ * // r: 67518627037915514985321278857825384106482999609634873287406612756843916814n,
19685
+ * // s: 737198738569840639192844101690009498983611654458636624293579534560862067709n, recovery: 0 },
19686
+ * // signerAddress: '0x655f8fd7c4013c07cf12a92184aa6c314d181443913e21f7e209a18f0c78492',
19687
+ * // version: '2'
19688
+ * // }
19689
+ * ```
19690
+ */
19691
+ async getOutsideTransaction(options, calls, version, nonce) {
19692
+ if (!isHex2(options.caller) && options.caller !== "ANY_CALLER") {
19693
+ throw new Error(`The caller ${options.caller} is not valid.`);
19694
+ }
19695
+ const codedCaller = isHex2(options.caller) ? options.caller : OutsideExecutionCallerAny;
19696
+ const myCalls = [calls].flat();
19697
+ const supportedVersion = version ?? await this.getSnip9Version();
19698
+ if (!supportedVersion) {
19699
+ throw new Error("This account is not handling outside transactions.");
19700
+ }
19701
+ const myNonce = nonce ? toHex(nonce) : await this.getSnip9Nonce();
19702
+ const message = getTypedData(
19703
+ await this.getChainId(),
19704
+ {
19705
+ caller: codedCaller,
19706
+ execute_after: options.execute_after,
19707
+ execute_before: options.execute_before
19708
+ },
19709
+ myNonce,
19710
+ myCalls,
19711
+ supportedVersion
19712
+ );
19713
+ const sign2 = await this.signMessage(message);
19714
+ const toExecute = {
19715
+ caller: codedCaller,
19716
+ nonce: myNonce,
19717
+ execute_after: options.execute_after,
19718
+ execute_before: options.execute_before,
19719
+ calls: myCalls.map(getOutsideCall)
19720
+ };
19721
+ return {
19722
+ outsideExecution: toExecute,
19723
+ signature: sign2,
19724
+ signerAddress: this.address,
19725
+ version: supportedVersion
19726
+ };
19727
+ }
19728
+ /**
19729
+ * An account B executes a transaction that has been signed by an account A.
19730
+ * Fees are paid by B.
19731
+ * @param {AllowArray<OutsideTransaction>} outsideTransaction the signed transaction generated by `Account.getOutsideTransaction()`.
19732
+ * @param {UniversalDetails} [opts] same options than `Account.execute()`.
19733
+ * @returns {InvokeFunctionResponse} same response than `Account.execute()`.
19734
+ * @example
19735
+ * ```typescript
19736
+ * const outsideTransaction1: OutsideTransaction = await signerAccount.getOutsideTransaction(callOptions, call1);
19737
+ * const outsideTransaction2: OutsideTransaction = await signerAccount.getOutsideTransaction(callOptions4, call4);
19738
+ * const result = await myAccount.executeFromOutside([
19739
+ outsideTransaction1,
19740
+ outsideTransaction2,
19741
+ ]);
19742
+ * // result = { transaction_hash: '0x11233...`}
19743
+ * ```
19744
+ */
19745
+ async executeFromOutside(outsideTransaction, opts) {
19746
+ const multiCall = buildExecuteFromOutsideCall(outsideTransaction);
19747
+ return this.execute(multiCall, opts);
19748
+ }
19749
+ /*
19750
+ * Support methods
19751
+ */
19752
+ /**
19753
+ * Helper method to resolve details with tip estimation
19754
+ * @private
19755
+ */
19756
+ async resolveDetailsWithTip(details) {
19757
+ return {
19758
+ ...details,
19759
+ tip: details.tip ?? (await this.getEstimateTip())[this.defaultTipType]
19760
+ };
19761
+ }
19762
+ /**
19763
+ * Helper method to resolve transaction version
19764
+ * @private
19765
+ */
19766
+ resolveTransactionVersion(providedVersion) {
19767
+ return toTransactionVersion(
19768
+ this.transactionVersion || ETransactionVersion33.V3,
19769
+ providedVersion
19770
+ );
19771
+ }
19772
+ async buildInvocation(call, details) {
19773
+ const calldata = getExecuteCalldata(call, await this.getCairoVersion());
19774
+ const signature = !details.skipValidate ? await this.signer.signTransaction(call, details) : [];
19775
+ return {
19776
+ ...v3Details(details),
19777
+ contractAddress: this.address,
19778
+ calldata,
19779
+ signature
19780
+ };
19781
+ }
19782
+ async buildDeclarePayload(payload, details) {
19783
+ const { classHash, contract, compiledClassHash } = extractContractHashes(
19784
+ payload,
19785
+ await this.channel.getStarknetVersion()
19786
+ );
19787
+ const compressedCompiledContract = parseContract(contract);
19788
+ assert(
19789
+ !isUndefined(compiledClassHash) && (details.version === ETransactionVersion33.F3 || details.version === ETransactionVersion33.V3),
19790
+ "V3 Transaction work with Cairo1 Contracts and require compiledClassHash"
19791
+ );
19792
+ const signature = !details.skipValidate ? await this.signer.signDeclareTransaction({
19793
+ ...details,
19794
+ ...v3Details(details),
19795
+ classHash,
19796
+ compiledClassHash,
19797
+ senderAddress: details.walletAddress
19798
+ }) : [];
19799
+ return {
19800
+ senderAddress: details.walletAddress,
19801
+ signature,
19802
+ contract: compressedCompiledContract,
19803
+ compiledClassHash
19804
+ };
19805
+ }
19806
+ async buildAccountDeployPayload({
19807
+ classHash,
19808
+ addressSalt = 0,
19809
+ constructorCalldata = [],
19810
+ contractAddress: providedContractAddress
19811
+ }, details) {
19812
+ const compiledCalldata = CallData.compile(constructorCalldata);
19813
+ const contractAddress = providedContractAddress ?? calculateContractAddressFromHash(addressSalt, classHash, compiledCalldata, 0);
19814
+ const signature = !details.skipValidate ? await this.signer.signDeployAccountTransaction({
19815
+ ...details,
19816
+ ...v3Details(details),
19817
+ classHash,
19818
+ contractAddress,
19819
+ addressSalt,
19820
+ constructorCalldata: compiledCalldata
19821
+ }) : [];
19822
+ return {
19823
+ ...v3Details(details),
19824
+ classHash,
19825
+ addressSalt,
19826
+ constructorCalldata: compiledCalldata,
19827
+ signature
19828
+ };
19829
+ }
19830
+ async accountInvocationsFactory(invocations, details) {
19831
+ const { nonce, blockIdentifier, skipValidate = true } = details;
19832
+ const safeNonce = await this.getNonceSafe(nonce);
19833
+ const chainId = await this.getChainId();
19834
+ const versions = details.versions.map((it) => toTransactionVersion(it));
19835
+ const tx0Payload = "payload" in invocations[0] ? invocations[0].payload : invocations[0];
19836
+ const cairoVersion = invocations[0].type === api_exports3.ETransactionType.DEPLOY_ACCOUNT ? await this.getCairoVersion(tx0Payload.classHash) : await this.getCairoVersion();
19837
+ return Promise.all(
19838
+ [].concat(invocations).map(async (transaction, index) => {
19839
+ const txPayload = "payload" in transaction ? transaction.payload : transaction;
19840
+ const signerDetails = {
19841
+ ...v3Details(details),
19842
+ walletAddress: this.address,
19843
+ nonce: toBigInt(Number(safeNonce) + index),
19844
+ chainId,
19845
+ cairoVersion,
19846
+ version: versions[0],
19847
+ skipValidate
19848
+ };
19849
+ const common2 = {
19850
+ type: transaction.type,
19851
+ nonce: toBigInt(Number(safeNonce) + index),
19852
+ blockIdentifier,
19853
+ version: versions[0]
19854
+ };
19855
+ if (transaction.type === api_exports3.ETransactionType.INVOKE) {
19856
+ const payload = await this.buildInvocation(
19857
+ [].concat(txPayload),
19858
+ signerDetails
19859
+ );
19860
+ return {
19861
+ ...common2,
19862
+ ...payload,
19863
+ ...signerDetails
19864
+ };
19865
+ }
19866
+ if (transaction.type === api_exports3.ETransactionType.DEPLOY) {
19867
+ const { calls } = this.deployer.buildDeployerCall(txPayload, this.address);
19868
+ const payload = await this.buildInvocation(calls, signerDetails);
19869
+ return {
19870
+ ...common2,
19871
+ ...payload,
19872
+ ...signerDetails,
19873
+ type: api_exports3.ETransactionType.INVOKE
19874
+ };
19875
+ }
19876
+ if (transaction.type === api_exports3.ETransactionType.DECLARE) {
19877
+ assert(
19878
+ isSierra(txPayload.contract),
19879
+ "Declare fee estimation is not supported for Cairo0 contracts"
19880
+ );
19881
+ const payload = await this.buildDeclarePayload(txPayload, signerDetails);
19882
+ return {
19883
+ ...common2,
19884
+ ...payload,
19885
+ ...signerDetails
19886
+ };
19887
+ }
19888
+ if (transaction.type === api_exports3.ETransactionType.DEPLOY_ACCOUNT) {
19889
+ const payload = await this.buildAccountDeployPayload(txPayload, signerDetails);
19890
+ return {
19891
+ ...common2,
19892
+ ...payload,
19893
+ ...signerDetails
19894
+ };
19895
+ }
19896
+ throw Error(`accountInvocationsFactory: unsupported transaction type: ${transaction}`);
19897
+ })
19898
+ );
19899
+ }
19900
+ /*
19901
+ * SNIP-29 Paymaster
19902
+ */
19903
+ async buildPaymasterTransaction(calls, paymasterDetails) {
19904
+ if (!paymasterDetails.deploymentData) {
19905
+ const snip9Version = await this.getSnip9Version();
19906
+ if (snip9Version === OutsideExecutionVersion.UNSUPPORTED) {
19907
+ throw Error("Account is not compatible with SNIP-9");
19908
+ }
19909
+ }
19910
+ const parameters = {
19911
+ version: "0x1",
19912
+ feeMode: paymasterDetails.feeMode,
19913
+ timeBounds: paymasterDetails.timeBounds
19914
+ };
19915
+ let transaction;
19916
+ if (paymasterDetails.deploymentData) {
19917
+ if (calls.length > 0) {
19918
+ transaction = {
19919
+ type: "deploy_and_invoke",
19920
+ invoke: { userAddress: this.address, calls },
19921
+ deployment: paymasterDetails.deploymentData
19922
+ };
19923
+ } else {
19924
+ transaction = {
19925
+ type: "deploy",
19926
+ deployment: paymasterDetails.deploymentData
19927
+ };
19928
+ }
19929
+ } else {
19930
+ transaction = {
19931
+ type: "invoke",
19932
+ invoke: { userAddress: this.address, calls }
19933
+ };
19934
+ }
19935
+ return this.paymaster.buildTransaction(transaction, parameters);
19936
+ }
19937
+ async estimatePaymasterTransactionFee(calls, paymasterDetails) {
19938
+ const preparedTransaction = await this.buildPaymasterTransaction(calls, paymasterDetails);
19939
+ return preparedTransaction.fee;
19940
+ }
19941
+ async preparePaymasterTransaction(preparedTransaction) {
19942
+ let transaction;
19943
+ switch (preparedTransaction.type) {
19944
+ case "deploy_and_invoke": {
19945
+ const signature = await this.signMessage(preparedTransaction.typed_data);
19946
+ transaction = {
19947
+ type: "deploy_and_invoke",
19948
+ invoke: {
19949
+ userAddress: this.address,
19950
+ typedData: preparedTransaction.typed_data,
19951
+ signature: signatureToHexArray(signature)
19952
+ },
19953
+ deployment: preparedTransaction.deployment
19954
+ };
19955
+ break;
19956
+ }
19957
+ case "invoke": {
19958
+ const signature = await this.signMessage(preparedTransaction.typed_data);
19959
+ transaction = {
19960
+ type: "invoke",
19961
+ invoke: {
19962
+ userAddress: this.address,
19963
+ typedData: preparedTransaction.typed_data,
19964
+ signature: signatureToHexArray(signature)
19965
+ }
19966
+ };
19967
+ break;
19968
+ }
19969
+ case "deploy": {
19970
+ transaction = {
19971
+ type: "deploy",
19972
+ deployment: preparedTransaction.deployment
19973
+ };
19974
+ break;
19975
+ }
19976
+ default:
19977
+ throw Error("Invalid transaction type");
19978
+ }
19979
+ return transaction;
19980
+ }
19981
+ async executePaymasterTransaction(calls, paymasterDetails, maxFeeInGasToken) {
19982
+ const preparedTransaction = await this.buildPaymasterTransaction(calls, paymasterDetails);
19983
+ assertPaymasterTransactionSafety(
19984
+ preparedTransaction,
19985
+ calls,
19986
+ paymasterDetails,
19987
+ maxFeeInGasToken
19988
+ );
19989
+ const transaction = await this.preparePaymasterTransaction(preparedTransaction);
19990
+ return this.paymaster.executeTransaction(transaction, preparedTransaction.parameters).then((response) => ({ transaction_hash: response.transaction_hash }));
19991
+ }
19992
+ /*
19993
+ * External methods
19994
+ */
19995
+ /**
19996
+ * Get the Starknet ID for an address
19997
+ * @param address - The address to get the Starknet ID for
19998
+ * @param StarknetIdContract - The Starknet ID contract address (optional)
19999
+ * @returns The Starknet ID for the address
20000
+ */
20001
+ async getStarkName(address = this.address, StarknetIdContract2) {
20002
+ return super.getStarkName(address, StarknetIdContract2);
20003
+ }
20004
+ };
19154
20005
  var connect_exports = {};
19155
20006
  __export2(connect_exports, {
19156
20007
  addDeclareTransaction: () => addDeclareTransaction,
@@ -20076,6 +20927,178 @@ function useThresholdSign(opts) {
20076
20927
  finalize
20077
20928
  };
20078
20929
  }
20930
+ var DEFAULTS = {
20931
+ apiBaseUrl: "https://api.chipipay.com/v1",
20932
+ rpcUrl: "https://api.cartridge.gg/x/starknet/mainnet",
20933
+ chainId: "0x534e5f4d41494e",
20934
+ gasTankAddress: "0x232f9c4ec684c03caae94f75987ea0540c06173d96dd5c6705521eb45e28b0a"
20935
+ };
20936
+ async function derivePrivacyAccount(p) {
20937
+ const pool = await core.derivePoolKeypair({
20938
+ anchorSecret: p.anchorSecret,
20939
+ seedDomainTag: p.seedDomainTag
20940
+ });
20941
+ const companion = await core.deriveCompanionKeypair(p.anchorSecret);
20942
+ return {
20943
+ companionAddress: core.deriveCompanionAddress({
20944
+ publicKey: companion.publicKey,
20945
+ classHash: p.classHash
20946
+ }),
20947
+ companionKey: companion.privateKey,
20948
+ classHash: p.classHash,
20949
+ poolKey: BigInt(pool.privateKey)
20950
+ };
20951
+ }
20952
+ function buildCtx(config3, keys) {
20953
+ const rpcUrl = config3.rpcUrl ?? DEFAULTS.rpcUrl;
20954
+ return {
20955
+ provider: new RpcProvider2({ nodeUrl: rpcUrl }),
20956
+ chainId: config3.chainId ?? DEFAULTS.chainId,
20957
+ companionAddress: keys.companionAddress,
20958
+ companionKey: keys.companionKey,
20959
+ classHash: keys.classHash,
20960
+ poolKey: keys.poolKey,
20961
+ provingProvider: new core.ChipiProofProvider({
20962
+ baseUrl: config3.apiBaseUrl ?? DEFAULTS.apiBaseUrl,
20963
+ apiKey: config3.apiPublicKey,
20964
+ getBearerToken: config3.getBearerToken,
20965
+ chainId: config3.chainId ?? DEFAULTS.chainId
20966
+ }),
20967
+ gatewaySubmitUrl: config3.gatewaySubmitUrl,
20968
+ rpcUrl
20969
+ };
20970
+ }
20971
+ async function runShield(input) {
20972
+ const { config: config3, keys } = input;
20973
+ const ctx = buildCtx(config3, keys);
20974
+ input.onStep?.("prepare");
20975
+ input.onStep?.("fund");
20976
+ await core.requestGasFunding(keys.companionAddress, {
20977
+ baseUrl: config3.apiBaseUrl ?? DEFAULTS.apiBaseUrl,
20978
+ apiKey: config3.apiPublicKey,
20979
+ getBearerToken: config3.getBearerToken
20980
+ });
20981
+ if (input.fundDeposit) {
20982
+ input.onStep?.("deposit");
20983
+ await input.fundDeposit(keys.companionAddress, input.amount);
20984
+ }
20985
+ await core.waitForFunding(ctx.provider, keys.companionAddress, {
20986
+ strk: core.GAS_FUND_STRK,
20987
+ token: input.fundDeposit ? { address: input.token, amount: input.amount } : void 0
20988
+ });
20989
+ input.onStep?.("prove");
20990
+ const result = await core.execShield(ctx, input.token, input.amount);
20991
+ input.onStep?.("finish");
20992
+ void core.sweepCompanion({
20993
+ provider: ctx.provider,
20994
+ companionAddress: keys.companionAddress,
20995
+ companionKey: keys.companionKey,
20996
+ gasTank: config3.gasTankAddress ?? DEFAULTS.gasTankAddress
20997
+ });
20998
+ return result;
20999
+ }
21000
+ async function runUnshield(input) {
21001
+ const { config: config3, keys } = input;
21002
+ const ctx = buildCtx(config3, keys);
21003
+ input.onStep?.("prepare");
21004
+ input.onStep?.("fund");
21005
+ await core.requestGasFunding(keys.companionAddress, {
21006
+ baseUrl: config3.apiBaseUrl ?? DEFAULTS.apiBaseUrl,
21007
+ apiKey: config3.apiPublicKey,
21008
+ getBearerToken: config3.getBearerToken
21009
+ });
21010
+ await core.waitForFunding(ctx.provider, keys.companionAddress, { strk: core.GAS_FUND_STRK });
21011
+ input.onStep?.("prove");
21012
+ const result = await core.execUnshield(ctx, input.token, input.amount);
21013
+ input.onStep?.("finish");
21014
+ const swept = await core.sweepCompanion({
21015
+ provider: ctx.provider,
21016
+ companionAddress: keys.companionAddress,
21017
+ companionKey: keys.companionKey,
21018
+ gasTank: config3.gasTankAddress ?? DEFAULTS.gasTankAddress,
21019
+ deliverToken: { address: input.token, to: input.deliverTo },
21020
+ strict: true
21021
+ });
21022
+ if (swept.transactionHash === null) {
21023
+ throw new Error(
21024
+ "unshield_undelivered: the withdrawal settled but delivery to your wallet could not be confirmed \u2014 funds are safe in the companion account; retry"
21025
+ );
21026
+ }
21027
+ return result;
21028
+ }
21029
+ function useShield() {
21030
+ const mutation = reactQuery.useMutation({ mutationFn: runShield });
21031
+ return {
21032
+ shield: mutation.mutate,
21033
+ shieldAsync: mutation.mutateAsync,
21034
+ data: mutation.data,
21035
+ isLoading: mutation.isPending,
21036
+ isError: mutation.isError,
21037
+ error: mutation.error,
21038
+ isSuccess: mutation.isSuccess,
21039
+ reset: mutation.reset
21040
+ };
21041
+ }
21042
+ function useUnshield() {
21043
+ const mutation = reactQuery.useMutation({
21044
+ mutationFn: runUnshield
21045
+ });
21046
+ return {
21047
+ unshield: mutation.mutate,
21048
+ unshieldAsync: mutation.mutateAsync,
21049
+ data: mutation.data,
21050
+ isLoading: mutation.isPending,
21051
+ isError: mutation.isError,
21052
+ error: mutation.error,
21053
+ isSuccess: mutation.isSuccess,
21054
+ reset: mutation.reset
21055
+ };
21056
+ }
21057
+ function netPrivateBalance(events) {
21058
+ const byToken = {};
21059
+ for (const e of events) {
21060
+ const signed = e.direction === "shield" ? e.amount : -e.amount;
21061
+ byToken[e.token] = (byToken[e.token] ?? 0n) + signed;
21062
+ }
21063
+ for (const k of Object.keys(byToken)) if (byToken[k] < 0n) byToken[k] = 0n;
21064
+ return byToken;
21065
+ }
21066
+ function usePrivateBalance(input) {
21067
+ const query = reactQuery.useQuery({
21068
+ queryKey: [
21069
+ "chipi-private-balance",
21070
+ input.mode,
21071
+ // A stale cache here is a stale MONEY balance (review finding m1):
21072
+ // ledger mode keys on a content digest (length alone missed same-count
21073
+ // edits); onchain mode keys on the account AND the token filter.
21074
+ input.mode === "ledger" ? input.events.reduce((h, e) => h + (e.direction === "shield" ? e.amount : -e.amount), 0n).toString() + ":" + input.events.length : input.keys.companionAddress + ":" + (input.tokens ?? []).join(",")
21075
+ ],
21076
+ queryFn: async () => {
21077
+ if (input.mode === "ledger") return netPrivateBalance(input.events);
21078
+ const ctx = buildCtx(input.config, input.keys);
21079
+ const { byToken } = await core.getPrivateBalance({
21080
+ provider: ctx.provider,
21081
+ account: new Account({
21082
+ provider: ctx.provider,
21083
+ address: input.keys.companionAddress,
21084
+ signer: input.keys.companionKey,
21085
+ cairoVersion: "1"
21086
+ }),
21087
+ viewingKey: input.keys.poolKey,
21088
+ provingProvider: ctx.provingProvider,
21089
+ tokens: input.tokens
21090
+ });
21091
+ return byToken;
21092
+ }
21093
+ });
21094
+ return {
21095
+ byToken: query.data ?? {},
21096
+ isLoading: query.isLoading,
21097
+ isError: query.isError,
21098
+ error: query.error,
21099
+ refetch: query.refetch
21100
+ };
21101
+ }
20079
21102
 
20080
21103
  // src/connect/window-object.ts
20081
21104
  var SUPPORTED_SPECS = ["0.8"];
@@ -20426,7 +21449,9 @@ exports.ChipiInjector = ChipiInjector;
20426
21449
  exports.ChipiProvider = ChipiProvider;
20427
21450
  exports.Recover = Recover;
20428
21451
  exports.createChipiWindowObject = createChipiWindowObject;
21452
+ exports.derivePrivacyAccount = derivePrivacyAccount;
20429
21453
  exports.injectChipiWallet = injectChipiWallet;
21454
+ exports.netPrivateBalance = netPrivateBalance;
20430
21455
  exports.useAddSessionKeyToContract = useAddSessionKeyToContract;
20431
21456
  exports.useApprove = useApprove;
20432
21457
  exports.useCallAnyContract = useCallAnyContract;
@@ -20449,14 +21474,17 @@ exports.useGetWallet = useGetWallet;
20449
21474
  exports.useGuardianRecovery = useGuardianRecovery;
20450
21475
  exports.useMigrateWalletToPasskey = useMigrateWalletToPasskey;
20451
21476
  exports.useMigrateWalletToShhh = useMigrateWalletToShhh;
21477
+ exports.usePrivateBalance = usePrivateBalance;
20452
21478
  exports.usePurchaseSku = usePurchaseSku;
20453
21479
  exports.useRecordSendTransaction = useRecordSendTransaction;
20454
21480
  exports.useRevokeSessionKey = useRevokeSessionKey;
20455
21481
  exports.useShhhSigner = useShhhSigner;
21482
+ exports.useShield = useShield;
20456
21483
  exports.useSignTypedData = useSignTypedData;
20457
21484
  exports.useSyncOnChainTransfers = useSyncOnChainTransfers;
20458
21485
  exports.useThresholdSign = useThresholdSign;
20459
21486
  exports.useTransfer = useTransfer;
21487
+ exports.useUnshield = useUnshield;
20460
21488
  exports.useUpdateWalletEncryption = useUpdateWalletEncryption;
20461
21489
  exports.useX402Payment = useX402Payment;
20462
21490
  //# sourceMappingURL=index.js.map