@getpara/react-sdk 2.0.0-alpha.33 → 2.0.0-alpha.35

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.
Files changed (42) hide show
  1. package/dist/{chunk-3GWWZKX7.js → chunk-MMUBH76A.js} +22 -1
  2. package/dist/cosmos/actions/getCosmjsAminoSigner.d.ts +8 -0
  3. package/dist/cosmos/actions/getCosmjsAminoSigner.js +16 -0
  4. package/dist/cosmos/actions/getCosmjsProtoSigner.d.ts +8 -0
  5. package/dist/cosmos/actions/getCosmjsProtoSigner.js +16 -0
  6. package/dist/cosmos/actions/index.d.ts +2 -0
  7. package/dist/cosmos/actions/index.js +3 -0
  8. package/dist/cosmos/hooks/index.d.ts +2 -0
  9. package/dist/cosmos/hooks/index.js +3 -0
  10. package/dist/cosmos/hooks/useCosmjsAminoSigner.d.ts +11 -0
  11. package/dist/cosmos/hooks/useCosmjsAminoSigner.js +37 -0
  12. package/dist/cosmos/hooks/useCosmjsProtoSigner.d.ts +11 -0
  13. package/dist/cosmos/hooks/useCosmjsProtoSigner.js +37 -0
  14. package/dist/cosmos/index.d.ts +2 -0
  15. package/dist/cosmos/index.js +3 -0
  16. package/dist/evm/actions/getViemAccount.d.ts +22 -0
  17. package/dist/evm/actions/getViemAccount.js +20 -0
  18. package/dist/evm/actions/getViemClient.d.ts +7659 -0
  19. package/dist/evm/actions/getViemClient.js +25 -0
  20. package/dist/evm/actions/index.d.ts +2 -0
  21. package/dist/evm/actions/index.js +3 -0
  22. package/dist/evm/hooks/index.d.ts +2 -0
  23. package/dist/evm/hooks/index.js +3 -0
  24. package/dist/evm/hooks/useViemAccount.d.ts +26 -0
  25. package/dist/evm/hooks/useViemAccount.js +32 -0
  26. package/dist/evm/hooks/useViemClient.d.ts +7663 -0
  27. package/dist/evm/hooks/useViemClient.js +30 -0
  28. package/dist/evm/index.d.ts +2 -0
  29. package/dist/evm/index.js +3 -0
  30. package/dist/index.js +1 -1
  31. package/dist/provider/ParaProvider.js +1 -1
  32. package/dist/solana/actions/getSolanaSigner.d.ts +8 -0
  33. package/dist/solana/actions/getSolanaSigner.js +15 -0
  34. package/dist/solana/actions/index.d.ts +1 -0
  35. package/dist/solana/actions/index.js +2 -0
  36. package/dist/solana/hooks/index.d.ts +1 -0
  37. package/dist/solana/hooks/index.js +2 -0
  38. package/dist/solana/hooks/useSolanaSigner.d.ts +12 -0
  39. package/dist/solana/hooks/useSolanaSigner.js +32 -0
  40. package/dist/solana/index.d.ts +2 -0
  41. package/dist/solana/index.js +3 -0
  42. package/package.json +19 -7
@@ -30,9 +30,30 @@ var __objRest = (source, exclude) => {
30
30
  }
31
31
  return target;
32
32
  };
33
+ var __async = (__this, __arguments, generator) => {
34
+ return new Promise((resolve, reject) => {
35
+ var fulfilled = (value) => {
36
+ try {
37
+ step(generator.next(value));
38
+ } catch (e) {
39
+ reject(e);
40
+ }
41
+ };
42
+ var rejected = (value) => {
43
+ try {
44
+ step(generator.throw(value));
45
+ } catch (e) {
46
+ reject(e);
47
+ }
48
+ };
49
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
50
+ step((generator = generator.apply(__this, __arguments)).next());
51
+ });
52
+ };
33
53
 
34
54
  export {
35
55
  __spreadValues,
36
56
  __spreadProps,
37
- __objRest
57
+ __objRest,
58
+ __async
38
59
  };
@@ -0,0 +1,8 @@
1
+ import ParaWeb from '@getpara/react-sdk-lite';
2
+ import { ParaAminoSigner } from '@getpara/cosmjs-v0-integration';
3
+ export declare const getCosmjsAminoSigner: ({ para, prefix, walletId, messageSigningTimeoutMs, }: {
4
+ para: ParaWeb;
5
+ prefix?: string;
6
+ walletId?: string;
7
+ messageSigningTimeoutMs?: number;
8
+ }) => Promise<ParaAminoSigner>;
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../chunk-MMUBH76A.js";
5
+ import { ParaAminoSigner } from "@getpara/cosmjs-v0-integration";
6
+ const getCosmjsAminoSigner = (_0) => __async(void 0, [_0], function* ({
7
+ para,
8
+ prefix,
9
+ walletId,
10
+ messageSigningTimeoutMs
11
+ }) {
12
+ return new ParaAminoSigner(para, prefix, walletId, messageSigningTimeoutMs);
13
+ });
14
+ export {
15
+ getCosmjsAminoSigner
16
+ };
@@ -0,0 +1,8 @@
1
+ import ParaWeb from '@getpara/react-sdk-lite';
2
+ import { ParaProtoSigner } from '@getpara/cosmjs-v0-integration';
3
+ export declare const getCosmjsProtoSigner: ({ para, prefix, walletId, messageSigningTimeoutMs, }: {
4
+ para: ParaWeb;
5
+ prefix?: string;
6
+ walletId?: string;
7
+ messageSigningTimeoutMs?: number;
8
+ }) => Promise<ParaProtoSigner>;
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../chunk-MMUBH76A.js";
5
+ import { ParaProtoSigner } from "@getpara/cosmjs-v0-integration";
6
+ const getCosmjsProtoSigner = (_0) => __async(void 0, [_0], function* ({
7
+ para,
8
+ prefix,
9
+ walletId,
10
+ messageSigningTimeoutMs
11
+ }) {
12
+ return new ParaProtoSigner(para, prefix, walletId, messageSigningTimeoutMs);
13
+ });
14
+ export {
15
+ getCosmjsProtoSigner
16
+ };
@@ -0,0 +1,2 @@
1
+ export * from './getCosmjsProtoSigner.js';
2
+ export * from './getCosmjsAminoSigner.js';
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ export * from "./getCosmjsProtoSigner.js";
3
+ export * from "./getCosmjsAminoSigner.js";
@@ -0,0 +1,2 @@
1
+ export * from './useCosmjsProtoSigner.js';
2
+ export * from './useCosmjsAminoSigner.js';
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ export * from "./useCosmjsProtoSigner.js";
3
+ export * from "./useCosmjsAminoSigner.js";
@@ -0,0 +1,11 @@
1
+ export declare const COSMJS_AMINO_SIGNER_BASE_KEY = "PARA_COSMJS_AMINO_SIGNER";
2
+ type UseCosmjsAminoSignerParameters = {
3
+ prefix?: string;
4
+ walletId?: string;
5
+ messageSigningTimeoutMs?: number;
6
+ };
7
+ export declare const useCosmjsAminoSigner: ({ prefix, walletId, messageSigningTimeoutMs }?: UseCosmjsAminoSignerParameters) => {
8
+ aminoSigner: import("@getpara/cosmjs-v0-integration").ParaAminoSigner | null | undefined;
9
+ isLoading: boolean;
10
+ };
11
+ export {};
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../chunk-MMUBH76A.js";
5
+ import { useAccount, useClient, useWallet } from "@getpara/react-sdk-lite";
6
+ import { useQuery } from "@tanstack/react-query";
7
+ import { getCosmjsAminoSigner } from "../actions/index.js";
8
+ const COSMJS_AMINO_SIGNER_BASE_KEY = "PARA_COSMJS_AMINO_SIGNER";
9
+ const useCosmjsAminoSigner = ({ prefix, walletId, messageSigningTimeoutMs } = {}) => {
10
+ const para = useClient();
11
+ const {
12
+ isConnected,
13
+ embedded: { userId }
14
+ } = useAccount();
15
+ const { data: wallet } = useWallet();
16
+ const { data, isLoading } = useQuery({
17
+ queryKey: [
18
+ COSMJS_AMINO_SIGNER_BASE_KEY,
19
+ isConnected,
20
+ userId,
21
+ walletId != null ? walletId : (wallet == null ? void 0 : wallet.type) === "COSMOS" ? wallet == null ? void 0 : wallet.id : null
22
+ ],
23
+ enabled: isConnected && !!para,
24
+ queryFn: () => __async(void 0, null, function* () {
25
+ if (!isConnected || !para) {
26
+ return null;
27
+ }
28
+ const _id = walletId != null ? walletId : (wallet == null ? void 0 : wallet.type) === "COSMOS" ? wallet == null ? void 0 : wallet.id : void 0;
29
+ return yield getCosmjsAminoSigner({ para, walletId: _id, prefix, messageSigningTimeoutMs });
30
+ })
31
+ });
32
+ return { aminoSigner: data, isLoading };
33
+ };
34
+ export {
35
+ COSMJS_AMINO_SIGNER_BASE_KEY,
36
+ useCosmjsAminoSigner
37
+ };
@@ -0,0 +1,11 @@
1
+ export declare const COSMJS_PROTO_SIGNER_BASE_KEY = "PARA_COSMJS_PROTO_SIGNER";
2
+ type UseCosmjsProtoSignerParameters = {
3
+ prefix?: string;
4
+ walletId?: string;
5
+ messageSigningTimeoutMs?: number;
6
+ };
7
+ export declare const useCosmjsProtoSigner: ({ prefix, walletId, messageSigningTimeoutMs }?: UseCosmjsProtoSignerParameters) => {
8
+ protoSigner: import("@getpara/cosmjs-v0-integration").ParaProtoSigner | null | undefined;
9
+ isLoading: boolean;
10
+ };
11
+ export {};
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../chunk-MMUBH76A.js";
5
+ import { useAccount, useClient, useWallet } from "@getpara/react-sdk-lite";
6
+ import { useQuery } from "@tanstack/react-query";
7
+ import { getCosmjsProtoSigner } from "../actions/index.js";
8
+ const COSMJS_PROTO_SIGNER_BASE_KEY = "PARA_COSMJS_PROTO_SIGNER";
9
+ const useCosmjsProtoSigner = ({ prefix, walletId, messageSigningTimeoutMs } = {}) => {
10
+ const para = useClient();
11
+ const {
12
+ isConnected,
13
+ embedded: { userId }
14
+ } = useAccount();
15
+ const { data: wallet } = useWallet();
16
+ const { data, isLoading } = useQuery({
17
+ queryKey: [
18
+ COSMJS_PROTO_SIGNER_BASE_KEY,
19
+ isConnected,
20
+ userId,
21
+ walletId != null ? walletId : (wallet == null ? void 0 : wallet.type) === "COSMOS" ? wallet == null ? void 0 : wallet.id : null
22
+ ],
23
+ enabled: isConnected && !!para,
24
+ queryFn: () => __async(void 0, null, function* () {
25
+ if (!isConnected || !para) {
26
+ return null;
27
+ }
28
+ const _id = walletId != null ? walletId : (wallet == null ? void 0 : wallet.type) === "COSMOS" ? wallet == null ? void 0 : wallet.id : void 0;
29
+ return yield getCosmjsProtoSigner({ para, walletId: _id, prefix, messageSigningTimeoutMs });
30
+ })
31
+ });
32
+ return { protoSigner: data, isLoading };
33
+ };
34
+ export {
35
+ COSMJS_PROTO_SIGNER_BASE_KEY,
36
+ useCosmjsProtoSigner
37
+ };
@@ -0,0 +1,2 @@
1
+ export * from './hooks/index.js';
2
+ export * from './actions/index.js';
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ export * from "./hooks/index.js";
3
+ export * from "./actions/index.js";
@@ -0,0 +1,22 @@
1
+ import ParaWeb from '@getpara/react-sdk-lite';
2
+ export declare const getViemAccount: ({ para, address }: {
3
+ para: ParaWeb;
4
+ address?: `0x${string}`;
5
+ }) => Promise<{
6
+ address: import("abitype").Address;
7
+ nonceManager?: import("viem").NonceManager | undefined;
8
+ sign?: ((parameters: {
9
+ hash: import("viem").Hash;
10
+ }) => Promise<import("viem").Hex>) | undefined | undefined;
11
+ signAuthorization?: ((parameters: import("viem/_types/types/authorization").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>) | undefined | undefined;
12
+ signMessage: ({ message }: {
13
+ message: import("viem").SignableMessage;
14
+ }) => Promise<import("viem").Hex>;
15
+ signTransaction: <serializer extends import("viem").SerializeTransactionFn<import("viem").TransactionSerializable> = import("viem").SerializeTransactionFn<import("viem").TransactionSerializable>, transaction extends Parameters<serializer>[0] = Parameters<serializer>[0]>(transaction: transaction, options?: {
16
+ serializer?: serializer | undefined;
17
+ } | undefined) => Promise<import("viem").IsNarrowable<import("viem").TransactionSerialized<import("viem").GetTransactionType<transaction>>, import("viem").Hex> extends true ? import("viem").TransactionSerialized<import("viem").GetTransactionType<transaction>> : import("viem").Hex>;
18
+ signTypedData: <const typedData extends import("abitype").TypedData | Record<string, unknown>, primaryType extends keyof typedData | "EIP712Domain" = keyof typedData>(parameters: import("viem").TypedDataDefinition<typedData, primaryType>) => Promise<import("viem").Hex>;
19
+ publicKey: import("viem").Hex;
20
+ source: string;
21
+ type: "local";
22
+ } | null>;
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../chunk-MMUBH76A.js";
5
+ import { createParaAccount } from "@getpara/viem-v2-integration";
6
+ const getViemAccount = (_0) => __async(void 0, [_0], function* ({ para, address }) {
7
+ if (para.getWalletsByType("EVM").length === 0) {
8
+ return null;
9
+ }
10
+ if (address) {
11
+ const wallet = para.findWallet(address);
12
+ if (wallet == null ? void 0 : wallet.isExternal) {
13
+ return null;
14
+ }
15
+ }
16
+ return yield createParaAccount(para, address);
17
+ });
18
+ export {
19
+ getViemAccount
20
+ };