@chipi-stack/chipi-react 14.16.0 → 14.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks.d.mts +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +19 -1
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +19 -2
- package/dist/hooks.mjs.map +1 -1
- package/dist/{index-Dbqp9oNS.d.mts → index-CUfzUBgv.d.mts} +34 -4
- package/dist/{index-Dbqp9oNS.d.ts → index-CUfzUBgv.d.ts} +34 -4
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +36 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1316,6 +1316,22 @@ function useSignTypedData() {
|
|
|
1316
1316
|
reset: mutation.reset
|
|
1317
1317
|
};
|
|
1318
1318
|
}
|
|
1319
|
+
function useExternalSignerExecute() {
|
|
1320
|
+
const { chipiSDK } = useChipiContext();
|
|
1321
|
+
const mutation = useMutation({
|
|
1322
|
+
mutationFn: async (input) => chipiSDK.executeWithExternalSigner(input)
|
|
1323
|
+
});
|
|
1324
|
+
return {
|
|
1325
|
+
execute: mutation.mutate,
|
|
1326
|
+
executeAsync: mutation.mutateAsync,
|
|
1327
|
+
data: mutation.data,
|
|
1328
|
+
isLoading: mutation.isPending,
|
|
1329
|
+
isError: mutation.isError,
|
|
1330
|
+
error: mutation.error,
|
|
1331
|
+
isSuccess: mutation.isSuccess,
|
|
1332
|
+
reset: mutation.reset
|
|
1333
|
+
};
|
|
1334
|
+
}
|
|
1319
1335
|
|
|
1320
1336
|
// ../node_modules/.pnpm/@starknet-io+types-js@0.9.2/node_modules/@starknet-io/types-js/dist/esm/index.js
|
|
1321
1337
|
var esm_exports = {};
|
|
@@ -20525,7 +20541,8 @@ function useChipiWalletObject(config3) {
|
|
|
20525
20541
|
return signTypedDataAsync({ encryptKey, wallet, typedData });
|
|
20526
20542
|
},
|
|
20527
20543
|
getDeploymentData: async () => {
|
|
20528
|
-
throw new Error("account_already_deployed");
|
|
20544
|
+
if (cfg.current.isDeployed === true) throw new Error("account_already_deployed");
|
|
20545
|
+
throw new Error("account_deployment_data_unavailable");
|
|
20529
20546
|
},
|
|
20530
20547
|
createSession: async (policy) => {
|
|
20531
20548
|
await createSession(policy);
|
|
@@ -21219,6 +21236,7 @@ var RpcError2 = class extends Error {
|
|
|
21219
21236
|
var USER_REFUSED_OP = 113;
|
|
21220
21237
|
var INVALID_REQUEST_PAYLOAD = 114;
|
|
21221
21238
|
var ACCOUNT_ALREADY_DEPLOYED = 115;
|
|
21239
|
+
var NO_DEPLOYMENT_DATA = 116;
|
|
21222
21240
|
var UNKNOWN_ERROR = 163;
|
|
21223
21241
|
var MISSING_APPROVAL_WARNING = "[ChipiSDK:Connect] No `requestApproval` was provided, so every approval (connect, execute, signTypedData, session) is denied. Pass `requestApproval` to show the user an approval UI and resolve true/false.";
|
|
21224
21242
|
function normalizeChainId(value) {
|
|
@@ -21288,15 +21306,19 @@ function createChipiWindowObject(deps) {
|
|
|
21288
21306
|
case "wallet_signTypedData": {
|
|
21289
21307
|
const typedData = call.params;
|
|
21290
21308
|
const domainChainId = typedData?.domain?.chainId;
|
|
21291
|
-
if (domainChainId
|
|
21292
|
-
|
|
21293
|
-
|
|
21294
|
-
|
|
21295
|
-
|
|
21296
|
-
|
|
21297
|
-
|
|
21298
|
-
|
|
21299
|
-
|
|
21309
|
+
if (domainChainId === void 0 || domainChainId === null) {
|
|
21310
|
+
throw new RpcError2(
|
|
21311
|
+
INVALID_REQUEST_PAYLOAD,
|
|
21312
|
+
`wallet_signTypedData: domain.chainId is required (the wallet chain is ${deps.chainId})`
|
|
21313
|
+
);
|
|
21314
|
+
}
|
|
21315
|
+
const expected = normalizeChainId(deps.chainId);
|
|
21316
|
+
const actual = normalizeChainId(domainChainId);
|
|
21317
|
+
if (actual === null || expected === null || actual !== expected) {
|
|
21318
|
+
throw new RpcError2(
|
|
21319
|
+
INVALID_REQUEST_PAYLOAD,
|
|
21320
|
+
`wallet_signTypedData: domain.chainId ${String(domainChainId)} does not match the wallet chain ${deps.chainId}`
|
|
21321
|
+
);
|
|
21300
21322
|
}
|
|
21301
21323
|
await requireApproval({ type: "signTypedData", typedData });
|
|
21302
21324
|
return deps.signTypedData(typedData);
|
|
@@ -21308,6 +21330,9 @@ function createChipiWindowObject(deps) {
|
|
|
21308
21330
|
if (err2 instanceof Error && err2.message === "account_already_deployed") {
|
|
21309
21331
|
throw new RpcError2(ACCOUNT_ALREADY_DEPLOYED, "Account already deployed");
|
|
21310
21332
|
}
|
|
21333
|
+
if (err2 instanceof Error && err2.message === "account_deployment_data_unavailable") {
|
|
21334
|
+
throw new RpcError2(NO_DEPLOYMENT_DATA, "Account deployment data is not available");
|
|
21335
|
+
}
|
|
21311
21336
|
throw new RpcError2(
|
|
21312
21337
|
UNKNOWN_ERROR,
|
|
21313
21338
|
err2 instanceof Error ? err2.message : "Could not read deployment data"
|
|
@@ -21602,6 +21627,6 @@ pako/dist/pako.esm.mjs:
|
|
|
21602
21627
|
(*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) *)
|
|
21603
21628
|
*/
|
|
21604
21629
|
|
|
21605
|
-
export { ChipiInjector, ChipiProvider, DEFAULT_RECOVER_LABELS, Recover, createChipiWindowObject, derivePrivacyAccount, injectChipiWallet, netPrivateBalance, useAddSessionKeyToContract, useApprove, useCallAnyContract, useChipiContext, useChipiSession, useChipiWallet, useChipiWalletObject, useCreateSessionKey, useCreateWallet, useExecuteWithSession, useGetSessionData, useGetSku, useGetSkuList, useGetSkuPurchase, useGetTokenBalance, useGetTransaction, useGetTransactionList, useGetTransactionStatus, useGetWallet, useGuardianRecovery, useMigrateWalletToPasskey, useMigrateWalletToShhh, usePrivateBalance, usePurchaseSku, useRecordSendTransaction, useRevokeSessionKey, useShhhSigner, useShield, useSignTypedData, useSyncOnChainTransfers, useThresholdSign, useTransfer, useUnshield, useUpdateWalletEncryption, useX402Payment, walletSupportsSessions };
|
|
21630
|
+
export { ChipiInjector, ChipiProvider, DEFAULT_RECOVER_LABELS, Recover, createChipiWindowObject, derivePrivacyAccount, injectChipiWallet, netPrivateBalance, useAddSessionKeyToContract, useApprove, useCallAnyContract, useChipiContext, useChipiSession, useChipiWallet, useChipiWalletObject, useCreateSessionKey, useCreateWallet, useExecuteWithSession, useExternalSignerExecute, useGetSessionData, useGetSku, useGetSkuList, useGetSkuPurchase, useGetTokenBalance, useGetTransaction, useGetTransactionList, useGetTransactionStatus, useGetWallet, useGuardianRecovery, useMigrateWalletToPasskey, useMigrateWalletToShhh, usePrivateBalance, usePurchaseSku, useRecordSendTransaction, useRevokeSessionKey, useShhhSigner, useShield, useSignTypedData, useSyncOnChainTransfers, useThresholdSign, useTransfer, useUnshield, useUpdateWalletEncryption, useX402Payment, walletSupportsSessions };
|
|
21606
21631
|
//# sourceMappingURL=index.mjs.map
|
|
21607
21632
|
//# sourceMappingURL=index.mjs.map
|