@iota/dapp-kit 0.3.0 → 0.3.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +2 -2
  3. package/dist/cjs/components/ConnectButton.js +19 -13
  4. package/dist/cjs/components/ConnectButton.js.map +2 -2
  5. package/dist/cjs/components/IotaClientProvider.js +1 -1
  6. package/dist/cjs/components/IotaClientProvider.js.map +2 -2
  7. package/dist/cjs/components/WalletProvider.js +1 -1
  8. package/dist/cjs/components/WalletProvider.js.map +2 -2
  9. package/dist/cjs/components/connect-modal/ConnectModal.js +19 -13
  10. package/dist/cjs/components/connect-modal/ConnectModal.js.map +2 -2
  11. package/dist/cjs/components/connect-modal/views/GetTheWallet.js +18 -12
  12. package/dist/cjs/components/connect-modal/views/GetTheWallet.js.map +2 -2
  13. package/dist/cjs/components/connect-modal/views/GettingStarted.js +1 -1
  14. package/dist/cjs/components/connect-modal/views/GettingStarted.js.map +1 -1
  15. package/dist/cjs/components/connect-modal/views/index.js +18 -12
  16. package/dist/cjs/components/connect-modal/views/index.js.map +2 -2
  17. package/dist/cjs/components/connect-modal/wallet-list/WalletList.js +18 -12
  18. package/dist/cjs/components/connect-modal/wallet-list/WalletList.js.map +2 -2
  19. package/dist/cjs/components/icons/IotaIcon.js +18 -12
  20. package/dist/cjs/components/icons/IotaIcon.js.map +2 -2
  21. package/dist/cjs/hooks/networkConfig.js +1 -1
  22. package/dist/cjs/hooks/networkConfig.js.map +2 -2
  23. package/dist/cjs/hooks/useIotaClient.js +1 -1
  24. package/dist/cjs/hooks/useIotaClient.js.map +2 -2
  25. package/dist/cjs/hooks/useIotaClientInfiniteQuery.js +1 -1
  26. package/dist/cjs/hooks/useIotaClientInfiniteQuery.js.map +2 -2
  27. package/dist/cjs/hooks/useIotaClientMutation.js +1 -1
  28. package/dist/cjs/hooks/useIotaClientMutation.js.map +2 -2
  29. package/dist/cjs/hooks/useIotaClientQueries.js +1 -1
  30. package/dist/cjs/hooks/useIotaClientQueries.js.map +2 -2
  31. package/dist/cjs/hooks/useIotaClientQuery.js +1 -1
  32. package/dist/cjs/hooks/useIotaClientQuery.js.map +2 -2
  33. package/dist/cjs/hooks/wallet/useSignAndExecuteTransaction.js +1 -1
  34. package/dist/cjs/hooks/wallet/useSignAndExecuteTransaction.js.map +2 -2
  35. package/dist/cjs/hooks/wallet/useSignTransaction.js +1 -1
  36. package/dist/cjs/hooks/wallet/useSignTransaction.js.map +2 -2
  37. package/dist/cjs/hooks/wallet/useUnsafeBurnerWallet.js +1 -1
  38. package/dist/cjs/hooks/wallet/useUnsafeBurnerWallet.js.map +2 -2
  39. package/dist/cjs/index.js +20 -14
  40. package/dist/cjs/index.js.map +2 -2
  41. package/dist/esm/components/ConnectButton.js +28 -22
  42. package/dist/esm/components/ConnectButton.js.map +3 -3
  43. package/dist/esm/components/IotaClientProvider.js +1 -1
  44. package/dist/esm/components/IotaClientProvider.js.map +2 -2
  45. package/dist/esm/components/WalletProvider.js +1 -1
  46. package/dist/esm/components/WalletProvider.js.map +2 -2
  47. package/dist/esm/components/connect-modal/ConnectModal.js +28 -22
  48. package/dist/esm/components/connect-modal/ConnectModal.js.map +3 -3
  49. package/dist/esm/components/connect-modal/views/GetTheWallet.js +23 -17
  50. package/dist/esm/components/connect-modal/views/GetTheWallet.js.map +3 -3
  51. package/dist/esm/components/connect-modal/views/GettingStarted.js +1 -1
  52. package/dist/esm/components/connect-modal/views/GettingStarted.js.map +1 -1
  53. package/dist/esm/components/connect-modal/views/index.js +23 -17
  54. package/dist/esm/components/connect-modal/views/index.js.map +3 -3
  55. package/dist/esm/components/connect-modal/wallet-list/WalletList.js +21 -15
  56. package/dist/esm/components/connect-modal/wallet-list/WalletList.js.map +3 -3
  57. package/dist/esm/components/icons/IotaIcon.js +19 -13
  58. package/dist/esm/components/icons/IotaIcon.js.map +2 -2
  59. package/dist/esm/hooks/networkConfig.js +1 -1
  60. package/dist/esm/hooks/networkConfig.js.map +2 -2
  61. package/dist/esm/hooks/useIotaClient.js +1 -1
  62. package/dist/esm/hooks/useIotaClient.js.map +2 -2
  63. package/dist/esm/hooks/useIotaClientInfiniteQuery.js +1 -1
  64. package/dist/esm/hooks/useIotaClientInfiniteQuery.js.map +2 -2
  65. package/dist/esm/hooks/useIotaClientMutation.js +1 -1
  66. package/dist/esm/hooks/useIotaClientMutation.js.map +2 -2
  67. package/dist/esm/hooks/useIotaClientQueries.js +1 -1
  68. package/dist/esm/hooks/useIotaClientQueries.js.map +2 -2
  69. package/dist/esm/hooks/useIotaClientQuery.js +1 -1
  70. package/dist/esm/hooks/useIotaClientQuery.js.map +2 -2
  71. package/dist/esm/hooks/wallet/useSignAndExecuteTransaction.js +1 -1
  72. package/dist/esm/hooks/wallet/useSignAndExecuteTransaction.js.map +2 -2
  73. package/dist/esm/hooks/wallet/useSignTransaction.js +1 -1
  74. package/dist/esm/hooks/wallet/useSignTransaction.js.map +2 -2
  75. package/dist/esm/hooks/wallet/useUnsafeBurnerWallet.js +1 -1
  76. package/dist/esm/hooks/wallet/useUnsafeBurnerWallet.js.map +2 -2
  77. package/dist/esm/index.js +36 -30
  78. package/dist/esm/index.js.map +3 -3
  79. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  80. package/dist/tsconfig.tsbuildinfo +1 -1
  81. package/package.json +4 -3
  82. package/src/components/IotaClientProvider.tsx +1 -1
  83. package/src/components/connect-modal/views/GettingStarted.tsx +1 -1
  84. package/src/components/icons/IotaIcon.tsx +10 -6
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/useIotaClientQueries.ts", "../../../src/hooks/useIotaClient.ts", "../../../src/components/IotaClientProvider.tsx"],
4
- "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQueries } from '@tanstack/react-query';\n\nimport { useIotaClientContext } from './useIotaClient.js';\nimport type { IotaRpcMethods, UseIotaClientQueryOptions } from './useIotaClientQuery.js';\n\ntype IotaClientQueryOptions = IotaRpcMethods[keyof IotaRpcMethods] extends infer Method\n ? Method extends {\n name: infer M extends keyof IotaRpcMethods;\n params?: infer P;\n }\n ? undefined extends P\n ? {\n method: M;\n params?: P;\n options?: UseIotaClientQueryOptions<M, unknown>;\n }\n : {\n method: M;\n params: P;\n options?: UseIotaClientQueryOptions<M, unknown>;\n }\n : never\n : never;\n\nexport type UseIotaClientQueriesResults<Args extends readonly IotaClientQueryOptions[]> = {\n -readonly [K in keyof Args]: Args[K] extends {\n method: infer M extends keyof IotaRpcMethods;\n readonly options?:\n | {\n select?: (...args: any[]) => infer R;\n }\n | object;\n }\n ? UseQueryResult<unknown extends R ? IotaRpcMethods[M]['result'] : R>\n : never;\n};\n\nexport function useIotaClientQueries<\n const Queries extends readonly IotaClientQueryOptions[],\n Results = UseIotaClientQueriesResults<Queries>,\n>({\n queries,\n combine,\n}: {\n queries: Queries;\n combine?: (results: UseIotaClientQueriesResults<Queries>) => Results;\n}): Results {\n const iotaContext = useIotaClientContext();\n\n return useQueries({\n combine: combine as never,\n queries: queries.map((query) => {\n const { method, params, options: { queryKey = [], ...restOptions } = {} } = query;\n\n return {\n ...restOptions,\n queryKey: [iotaContext.network, method, params, ...queryKey],\n queryFn: async () => {\n return await iotaContext.client[method](params as never);\n },\n };\n }) as [],\n });\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { useContext } from 'react';\n\nimport { IotaClientContext } from '../components/IotaClientProvider.js';\n\nexport function useIotaClientContext() {\n const iotaClient = useContext(IotaClientContext);\n\n if (!iotaClient) {\n throw new Error(\n 'Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider',\n );\n }\n\n return iotaClient;\n}\n\nexport function useIotaClient(): IotaClient {\n return useIotaClientContext().client;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getNetwork, isIotaClient, Network, IotaClient } from '@iota/iota-sdk/client';\nimport type { IotaClientOptions } from '@iota/iota-sdk/client';\nimport { createContext, useMemo, useState } from 'react';\n\nimport type { NetworkConfig } from '../hooks/networkConfig.js';\n\ntype NetworkConfigs<T extends NetworkConfig | IotaClient = NetworkConfig | IotaClient> = Record<\n string,\n T\n>;\n\nexport interface IotaClientProviderContext {\n client: IotaClient;\n networks: NetworkConfigs;\n network: string;\n config: NetworkConfig | null;\n selectNetwork: (network: string) => void;\n}\n\nexport const IotaClientContext = createContext<IotaClientProviderContext | null>(null);\n\nexport type IotaClientProviderProps<T extends NetworkConfigs> = {\n createClient?: (name: keyof T, config: T[keyof T]) => IotaClient;\n children: React.ReactNode;\n networks?: T;\n onNetworkChange?: (network: keyof T & string) => void;\n} & (\n | {\n defaultNetwork?: keyof T & string;\n network?: never;\n }\n | {\n defaultNetwork?: never;\n network?: keyof T & string;\n }\n);\n\nconst DEFAULT_NETWORKS = {\n localnet: { url: getNetwork(Network.Local).url },\n};\n\nconst DEFAULT_CREATE_CLIENT = function createClient(\n _name: string,\n config: NetworkConfig | IotaClient,\n) {\n if (isIotaClient(config)) {\n return config;\n }\n\n return new IotaClient(config);\n};\n\nexport function IotaClientProvider<T extends NetworkConfigs>(props: IotaClientProviderProps<T>) {\n const { onNetworkChange, network, children } = props;\n const networks = (props.networks ?? DEFAULT_NETWORKS) as T;\n const createClient =\n (props.createClient as typeof DEFAULT_CREATE_CLIENT) ?? DEFAULT_CREATE_CLIENT;\n\n const [selectedNetwork, setSelectedNetwork] = useState<keyof T & string>(\n props.network ?? props.defaultNetwork ?? (Object.keys(networks)[0] as keyof T & string),\n );\n\n const currentNetwork = props.network ?? selectedNetwork;\n\n const client = useMemo(() => {\n return createClient(currentNetwork, networks[currentNetwork]);\n }, [createClient, currentNetwork, networks]);\n\n const ctx = useMemo((): IotaClientProviderContext => {\n return {\n client,\n networks,\n network: currentNetwork,\n config:\n networks[currentNetwork] instanceof IotaClient\n ? null\n : (networks[currentNetwork] as IotaClientOptions),\n selectNetwork: (newNetwork) => {\n if (currentNetwork === newNetwork) {\n return;\n }\n\n if (!network && newNetwork !== selectedNetwork) {\n setSelectedNetwork(newNetwork);\n }\n\n onNetworkChange?.(newNetwork);\n },\n };\n }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);\n\n return <IotaClientContext.Provider value={ctx}>{children}</IotaClientContext.Provider>;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,yBAA2B;;;ACA3B,IAAAA,gBAA2B;;;ACD3B,oBAA8D;AAE9D,mBAAiD;AAyFtC;AAxEJ,IAAM,wBAAoB,4BAAgD,IAAI;AAkBrF,IAAM,mBAAmB;AAAA,EACrB,UAAU,EAAE,SAAK,0BAAW,sBAAQ,KAAK,EAAE,IAAI;AACnD;;;ADlCO,SAAS,uBAAuB;AACnC,QAAM,iBAAa,0BAAW,iBAAiB;AAE/C,MAAI,CAAC,YAAY;AACb,UAAM,IAAI;AAAA,MACN;AAAA,IACJ;AAAA,EACJ;AAEA,SAAO;AACX;;;ADuBO,SAAS,qBAGd;AAAA,EACE;AAAA,EACA;AACJ,GAGY;AACR,QAAM,cAAc,qBAAqB;AAEzC,aAAO,+BAAW;AAAA,IACd;AAAA,IACA,SAAS,QAAQ,IAAI,CAAC,UAAU;AAC5B,YAAM,EAAE,QAAQ,QAAQ,SAAS,EAAE,WAAW,CAAC,GAAG,GAAG,YAAY,IAAI,CAAC,EAAE,IAAI;AAE5E,aAAO;AAAA,QACH,GAAG;AAAA,QACH,UAAU,CAAC,YAAY,SAAS,QAAQ,QAAQ,GAAG,QAAQ;AAAA,QAC3D,SAAS,YAAY;AACjB,iBAAO,MAAM,YAAY,OAAO,MAAM,EAAE,MAAe;AAAA,QAC3D;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AACL;",
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { useQueries } from '@tanstack/react-query';\n\nimport { useIotaClientContext } from './useIotaClient.js';\nimport type { IotaRpcMethods, UseIotaClientQueryOptions } from './useIotaClientQuery.js';\n\ntype IotaClientQueryOptions = IotaRpcMethods[keyof IotaRpcMethods] extends infer Method\n ? Method extends {\n name: infer M extends keyof IotaRpcMethods;\n params?: infer P;\n }\n ? undefined extends P\n ? {\n method: M;\n params?: P;\n options?: UseIotaClientQueryOptions<M, unknown>;\n }\n : {\n method: M;\n params: P;\n options?: UseIotaClientQueryOptions<M, unknown>;\n }\n : never\n : never;\n\nexport type UseIotaClientQueriesResults<Args extends readonly IotaClientQueryOptions[]> = {\n -readonly [K in keyof Args]: Args[K] extends {\n method: infer M extends keyof IotaRpcMethods;\n readonly options?:\n | {\n select?: (...args: any[]) => infer R;\n }\n | object;\n }\n ? UseQueryResult<unknown extends R ? IotaRpcMethods[M]['result'] : R>\n : never;\n};\n\nexport function useIotaClientQueries<\n const Queries extends readonly IotaClientQueryOptions[],\n Results = UseIotaClientQueriesResults<Queries>,\n>({\n queries,\n combine,\n}: {\n queries: Queries;\n combine?: (results: UseIotaClientQueriesResults<Queries>) => Results;\n}): Results {\n const iotaContext = useIotaClientContext();\n\n return useQueries({\n combine: combine as never,\n queries: queries.map((query) => {\n const { method, params, options: { queryKey = [], ...restOptions } = {} } = query;\n\n return {\n ...restOptions,\n queryKey: [iotaContext.network, method, params, ...queryKey],\n queryFn: async () => {\n return await iotaContext.client[method](params as never);\n },\n };\n }) as [],\n });\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { useContext } from 'react';\n\nimport { IotaClientContext } from '../components/IotaClientProvider.js';\n\nexport function useIotaClientContext() {\n const iotaClient = useContext(IotaClientContext);\n\n if (!iotaClient) {\n throw new Error(\n 'Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider',\n );\n }\n\n return iotaClient;\n}\n\nexport function useIotaClient(): IotaClient {\n return useIotaClientContext().client;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getNetwork, isIotaClient, Network, IotaClient } from '@iota/iota-sdk/client';\nimport type { IotaClientOptions } from '@iota/iota-sdk/client';\nimport { createContext, useMemo, useState } from 'react';\n\nimport type { NetworkConfig } from '../hooks/networkConfig.js';\n\ntype NetworkConfigs<T extends NetworkConfig | IotaClient = NetworkConfig | IotaClient> = Record<\n string,\n T\n>;\n\nexport interface IotaClientProviderContext {\n client: IotaClient;\n networks: NetworkConfigs;\n network: string;\n config: NetworkConfig | null;\n selectNetwork: (network: string) => void;\n}\n\nexport const IotaClientContext = createContext<IotaClientProviderContext | null>(null);\n\nexport type IotaClientProviderProps<T extends NetworkConfigs> = {\n createClient?: (name: keyof T, config: T[keyof T]) => IotaClient;\n children: React.ReactNode;\n networks?: T;\n onNetworkChange?: (network: keyof T & string) => void;\n} & (\n | {\n defaultNetwork?: keyof T & string;\n network?: never;\n }\n | {\n defaultNetwork?: never;\n network?: keyof T & string;\n }\n);\n\nconst DEFAULT_NETWORKS = {\n localnet: { url: getNetwork(Network.Localnet).url },\n};\n\nconst DEFAULT_CREATE_CLIENT = function createClient(\n _name: string,\n config: NetworkConfig | IotaClient,\n) {\n if (isIotaClient(config)) {\n return config;\n }\n\n return new IotaClient(config);\n};\n\nexport function IotaClientProvider<T extends NetworkConfigs>(props: IotaClientProviderProps<T>) {\n const { onNetworkChange, network, children } = props;\n const networks = (props.networks ?? DEFAULT_NETWORKS) as T;\n const createClient =\n (props.createClient as typeof DEFAULT_CREATE_CLIENT) ?? DEFAULT_CREATE_CLIENT;\n\n const [selectedNetwork, setSelectedNetwork] = useState<keyof T & string>(\n props.network ?? props.defaultNetwork ?? (Object.keys(networks)[0] as keyof T & string),\n );\n\n const currentNetwork = props.network ?? selectedNetwork;\n\n const client = useMemo(() => {\n return createClient(currentNetwork, networks[currentNetwork]);\n }, [createClient, currentNetwork, networks]);\n\n const ctx = useMemo((): IotaClientProviderContext => {\n return {\n client,\n networks,\n network: currentNetwork,\n config:\n networks[currentNetwork] instanceof IotaClient\n ? null\n : (networks[currentNetwork] as IotaClientOptions),\n selectNetwork: (newNetwork) => {\n if (currentNetwork === newNetwork) {\n return;\n }\n\n if (!network && newNetwork !== selectedNetwork) {\n setSelectedNetwork(newNetwork);\n }\n\n onNetworkChange?.(newNetwork);\n },\n };\n }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);\n\n return <IotaClientContext.Provider value={ctx}>{children}</IotaClientContext.Provider>;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,yBAA2B;;;ACA3B,IAAAA,gBAA2B;;;ACD3B,oBAA8D;AAE9D,mBAAiD;AAyFtC;AAxEJ,IAAM,wBAAoB,4BAAgD,IAAI;AAkBrF,IAAM,mBAAmB;AAAA,EACrB,UAAU,EAAE,SAAK,0BAAW,sBAAQ,QAAQ,EAAE,IAAI;AACtD;;;ADlCO,SAAS,uBAAuB;AACnC,QAAM,iBAAa,0BAAW,iBAAiB;AAE/C,MAAI,CAAC,YAAY;AACb,UAAM,IAAI;AAAA,MACN;AAAA,IACJ;AAAA,EACJ;AAEA,SAAO;AACX;;;ADuBO,SAAS,qBAGd;AAAA,EACE;AAAA,EACA;AACJ,GAGY;AACR,QAAM,cAAc,qBAAqB;AAEzC,aAAO,+BAAW;AAAA,IACd;AAAA,IACA,SAAS,QAAQ,IAAI,CAAC,UAAU;AAC5B,YAAM,EAAE,QAAQ,QAAQ,SAAS,EAAE,WAAW,CAAC,GAAG,GAAG,YAAY,IAAI,CAAC,EAAE,IAAI;AAE5E,aAAO;AAAA,QACH,GAAG;AAAA,QACH,UAAU,CAAC,YAAY,SAAS,QAAQ,QAAQ,GAAG,QAAQ;AAAA,QAC3D,SAAS,YAAY;AACjB,iBAAO,MAAM,YAAY,OAAO,MAAM,EAAE,MAAe;AAAA,QAC3D;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AACL;",
6
6
  "names": ["import_react"]
7
7
  }
@@ -34,7 +34,7 @@ var import_react = require("react");
34
34
  var import_jsx_runtime = require("react/jsx-runtime");
35
35
  var IotaClientContext = (0, import_react.createContext)(null);
36
36
  var DEFAULT_NETWORKS = {
37
- localnet: { url: (0, import_client.getNetwork)(import_client.Network.Local).url }
37
+ localnet: { url: (0, import_client.getNetwork)(import_client.Network.Localnet).url }
38
38
  };
39
39
 
40
40
  // src/hooks/useIotaClient.ts
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/useIotaClientQuery.ts", "../../../src/hooks/useIotaClient.ts", "../../../src/components/IotaClientProvider.tsx"],
4
- "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport type { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\n\nimport type { PartialBy } from '../types/utilityTypes.js';\nimport { useIotaClientContext } from './useIotaClient.js';\n\nexport type IotaRpcMethodName = {\n [K in keyof IotaClient]: IotaClient[K] extends\n | ((input: any) => Promise<any>)\n | (() => Promise<any>)\n ? K\n : never;\n}[keyof IotaClient];\n\nexport type IotaRpcMethods = {\n [K in IotaRpcMethodName]: IotaClient[K] extends (input: infer P) => Promise<infer R>\n ? {\n name: K;\n result: R;\n params: P;\n }\n : IotaClient[K] extends () => Promise<infer R>\n ? {\n name: K;\n result: R;\n params: undefined | object;\n }\n : never;\n};\n\nexport type UseIotaClientQueryOptions<T extends keyof IotaRpcMethods, TData> = PartialBy<\n Omit<UseQueryOptions<IotaRpcMethods[T]['result'], Error, TData, unknown[]>, 'queryFn'>,\n 'queryKey'\n>;\n\nexport function useIotaClientQuery<\n T extends keyof IotaRpcMethods,\n TData = IotaRpcMethods[T]['result'],\n>(\n ...args: undefined extends IotaRpcMethods[T]['params']\n ? [\n method: T,\n params?: IotaRpcMethods[T]['params'],\n options?: UseIotaClientQueryOptions<T, TData>,\n ]\n : [\n method: T,\n params: IotaRpcMethods[T]['params'],\n options?: UseIotaClientQueryOptions<T, TData>,\n ]\n): UseQueryResult<TData, Error> {\n const [method, params, { queryKey = [], ...options } = {}] = args as [\n method: T,\n params?: IotaRpcMethods[T]['params'],\n options?: UseIotaClientQueryOptions<T, TData>,\n ];\n\n const iotaContext = useIotaClientContext();\n\n return useQuery({\n ...options,\n queryKey: [iotaContext.network, method, params, ...queryKey],\n queryFn: async () => {\n return (await iotaContext.client[method](\n params as never,\n )) as IotaRpcMethods[T]['result'];\n },\n });\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { useContext } from 'react';\n\nimport { IotaClientContext } from '../components/IotaClientProvider.js';\n\nexport function useIotaClientContext() {\n const iotaClient = useContext(IotaClientContext);\n\n if (!iotaClient) {\n throw new Error(\n 'Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider',\n );\n }\n\n return iotaClient;\n}\n\nexport function useIotaClient(): IotaClient {\n return useIotaClientContext().client;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getNetwork, isIotaClient, Network, IotaClient } from '@iota/iota-sdk/client';\nimport type { IotaClientOptions } from '@iota/iota-sdk/client';\nimport { createContext, useMemo, useState } from 'react';\n\nimport type { NetworkConfig } from '../hooks/networkConfig.js';\n\ntype NetworkConfigs<T extends NetworkConfig | IotaClient = NetworkConfig | IotaClient> = Record<\n string,\n T\n>;\n\nexport interface IotaClientProviderContext {\n client: IotaClient;\n networks: NetworkConfigs;\n network: string;\n config: NetworkConfig | null;\n selectNetwork: (network: string) => void;\n}\n\nexport const IotaClientContext = createContext<IotaClientProviderContext | null>(null);\n\nexport type IotaClientProviderProps<T extends NetworkConfigs> = {\n createClient?: (name: keyof T, config: T[keyof T]) => IotaClient;\n children: React.ReactNode;\n networks?: T;\n onNetworkChange?: (network: keyof T & string) => void;\n} & (\n | {\n defaultNetwork?: keyof T & string;\n network?: never;\n }\n | {\n defaultNetwork?: never;\n network?: keyof T & string;\n }\n);\n\nconst DEFAULT_NETWORKS = {\n localnet: { url: getNetwork(Network.Local).url },\n};\n\nconst DEFAULT_CREATE_CLIENT = function createClient(\n _name: string,\n config: NetworkConfig | IotaClient,\n) {\n if (isIotaClient(config)) {\n return config;\n }\n\n return new IotaClient(config);\n};\n\nexport function IotaClientProvider<T extends NetworkConfigs>(props: IotaClientProviderProps<T>) {\n const { onNetworkChange, network, children } = props;\n const networks = (props.networks ?? DEFAULT_NETWORKS) as T;\n const createClient =\n (props.createClient as typeof DEFAULT_CREATE_CLIENT) ?? DEFAULT_CREATE_CLIENT;\n\n const [selectedNetwork, setSelectedNetwork] = useState<keyof T & string>(\n props.network ?? props.defaultNetwork ?? (Object.keys(networks)[0] as keyof T & string),\n );\n\n const currentNetwork = props.network ?? selectedNetwork;\n\n const client = useMemo(() => {\n return createClient(currentNetwork, networks[currentNetwork]);\n }, [createClient, currentNetwork, networks]);\n\n const ctx = useMemo((): IotaClientProviderContext => {\n return {\n client,\n networks,\n network: currentNetwork,\n config:\n networks[currentNetwork] instanceof IotaClient\n ? null\n : (networks[currentNetwork] as IotaClientOptions),\n selectNetwork: (newNetwork) => {\n if (currentNetwork === newNetwork) {\n return;\n }\n\n if (!network && newNetwork !== selectedNetwork) {\n setSelectedNetwork(newNetwork);\n }\n\n onNetworkChange?.(newNetwork);\n },\n };\n }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);\n\n return <IotaClientContext.Provider value={ctx}>{children}</IotaClientContext.Provider>;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,yBAAyB;;;ACDzB,IAAAA,gBAA2B;;;ACD3B,oBAA8D;AAE9D,mBAAiD;AAyFtC;AAxEJ,IAAM,wBAAoB,4BAAgD,IAAI;AAkBrF,IAAM,mBAAmB;AAAA,EACrB,UAAU,EAAE,SAAK,0BAAW,sBAAQ,KAAK,EAAE,IAAI;AACnD;;;ADlCO,SAAS,uBAAuB;AACnC,QAAM,iBAAa,0BAAW,iBAAiB;AAE/C,MAAI,CAAC,YAAY;AACb,UAAM,IAAI;AAAA,MACN;AAAA,IACJ;AAAA,EACJ;AAEA,SAAO;AACX;;;ADqBO,SAAS,sBAIT,MAWyB;AAC5B,QAAM,CAAC,QAAQ,QAAQ,EAAE,WAAW,CAAC,GAAG,GAAG,QAAQ,IAAI,CAAC,CAAC,IAAI;AAM7D,QAAM,cAAc,qBAAqB;AAEzC,aAAO,6BAAS;AAAA,IACZ,GAAG;AAAA,IACH,UAAU,CAAC,YAAY,SAAS,QAAQ,QAAQ,GAAG,QAAQ;AAAA,IAC3D,SAAS,YAAY;AACjB,aAAQ,MAAM,YAAY,OAAO,MAAM;AAAA,QACnC;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ,CAAC;AACL;",
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport type { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\n\nimport type { PartialBy } from '../types/utilityTypes.js';\nimport { useIotaClientContext } from './useIotaClient.js';\n\nexport type IotaRpcMethodName = {\n [K in keyof IotaClient]: IotaClient[K] extends\n | ((input: any) => Promise<any>)\n | (() => Promise<any>)\n ? K\n : never;\n}[keyof IotaClient];\n\nexport type IotaRpcMethods = {\n [K in IotaRpcMethodName]: IotaClient[K] extends (input: infer P) => Promise<infer R>\n ? {\n name: K;\n result: R;\n params: P;\n }\n : IotaClient[K] extends () => Promise<infer R>\n ? {\n name: K;\n result: R;\n params: undefined | object;\n }\n : never;\n};\n\nexport type UseIotaClientQueryOptions<T extends keyof IotaRpcMethods, TData> = PartialBy<\n Omit<UseQueryOptions<IotaRpcMethods[T]['result'], Error, TData, unknown[]>, 'queryFn'>,\n 'queryKey'\n>;\n\nexport function useIotaClientQuery<\n T extends keyof IotaRpcMethods,\n TData = IotaRpcMethods[T]['result'],\n>(\n ...args: undefined extends IotaRpcMethods[T]['params']\n ? [\n method: T,\n params?: IotaRpcMethods[T]['params'],\n options?: UseIotaClientQueryOptions<T, TData>,\n ]\n : [\n method: T,\n params: IotaRpcMethods[T]['params'],\n options?: UseIotaClientQueryOptions<T, TData>,\n ]\n): UseQueryResult<TData, Error> {\n const [method, params, { queryKey = [], ...options } = {}] = args as [\n method: T,\n params?: IotaRpcMethods[T]['params'],\n options?: UseIotaClientQueryOptions<T, TData>,\n ];\n\n const iotaContext = useIotaClientContext();\n\n return useQuery({\n ...options,\n queryKey: [iotaContext.network, method, params, ...queryKey],\n queryFn: async () => {\n return (await iotaContext.client[method](\n params as never,\n )) as IotaRpcMethods[T]['result'];\n },\n });\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { useContext } from 'react';\n\nimport { IotaClientContext } from '../components/IotaClientProvider.js';\n\nexport function useIotaClientContext() {\n const iotaClient = useContext(IotaClientContext);\n\n if (!iotaClient) {\n throw new Error(\n 'Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider',\n );\n }\n\n return iotaClient;\n}\n\nexport function useIotaClient(): IotaClient {\n return useIotaClientContext().client;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getNetwork, isIotaClient, Network, IotaClient } from '@iota/iota-sdk/client';\nimport type { IotaClientOptions } from '@iota/iota-sdk/client';\nimport { createContext, useMemo, useState } from 'react';\n\nimport type { NetworkConfig } from '../hooks/networkConfig.js';\n\ntype NetworkConfigs<T extends NetworkConfig | IotaClient = NetworkConfig | IotaClient> = Record<\n string,\n T\n>;\n\nexport interface IotaClientProviderContext {\n client: IotaClient;\n networks: NetworkConfigs;\n network: string;\n config: NetworkConfig | null;\n selectNetwork: (network: string) => void;\n}\n\nexport const IotaClientContext = createContext<IotaClientProviderContext | null>(null);\n\nexport type IotaClientProviderProps<T extends NetworkConfigs> = {\n createClient?: (name: keyof T, config: T[keyof T]) => IotaClient;\n children: React.ReactNode;\n networks?: T;\n onNetworkChange?: (network: keyof T & string) => void;\n} & (\n | {\n defaultNetwork?: keyof T & string;\n network?: never;\n }\n | {\n defaultNetwork?: never;\n network?: keyof T & string;\n }\n);\n\nconst DEFAULT_NETWORKS = {\n localnet: { url: getNetwork(Network.Localnet).url },\n};\n\nconst DEFAULT_CREATE_CLIENT = function createClient(\n _name: string,\n config: NetworkConfig | IotaClient,\n) {\n if (isIotaClient(config)) {\n return config;\n }\n\n return new IotaClient(config);\n};\n\nexport function IotaClientProvider<T extends NetworkConfigs>(props: IotaClientProviderProps<T>) {\n const { onNetworkChange, network, children } = props;\n const networks = (props.networks ?? DEFAULT_NETWORKS) as T;\n const createClient =\n (props.createClient as typeof DEFAULT_CREATE_CLIENT) ?? DEFAULT_CREATE_CLIENT;\n\n const [selectedNetwork, setSelectedNetwork] = useState<keyof T & string>(\n props.network ?? props.defaultNetwork ?? (Object.keys(networks)[0] as keyof T & string),\n );\n\n const currentNetwork = props.network ?? selectedNetwork;\n\n const client = useMemo(() => {\n return createClient(currentNetwork, networks[currentNetwork]);\n }, [createClient, currentNetwork, networks]);\n\n const ctx = useMemo((): IotaClientProviderContext => {\n return {\n client,\n networks,\n network: currentNetwork,\n config:\n networks[currentNetwork] instanceof IotaClient\n ? null\n : (networks[currentNetwork] as IotaClientOptions),\n selectNetwork: (newNetwork) => {\n if (currentNetwork === newNetwork) {\n return;\n }\n\n if (!network && newNetwork !== selectedNetwork) {\n setSelectedNetwork(newNetwork);\n }\n\n onNetworkChange?.(newNetwork);\n },\n };\n }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);\n\n return <IotaClientContext.Provider value={ctx}>{children}</IotaClientContext.Provider>;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,yBAAyB;;;ACDzB,IAAAA,gBAA2B;;;ACD3B,oBAA8D;AAE9D,mBAAiD;AAyFtC;AAxEJ,IAAM,wBAAoB,4BAAgD,IAAI;AAkBrF,IAAM,mBAAmB;AAAA,EACrB,UAAU,EAAE,SAAK,0BAAW,sBAAQ,QAAQ,EAAE,IAAI;AACtD;;;ADlCO,SAAS,uBAAuB;AACnC,QAAM,iBAAa,0BAAW,iBAAiB;AAE/C,MAAI,CAAC,YAAY;AACb,UAAM,IAAI;AAAA,MACN;AAAA,IACJ;AAAA,EACJ;AAEA,SAAO;AACX;;;ADqBO,SAAS,sBAIT,MAWyB;AAC5B,QAAM,CAAC,QAAQ,QAAQ,EAAE,WAAW,CAAC,GAAG,GAAG,QAAQ,IAAI,CAAC,CAAC,IAAI;AAM7D,QAAM,cAAc,qBAAqB;AAEzC,aAAO,6BAAS;AAAA,IACZ,GAAG;AAAA,IACH,UAAU,CAAC,YAAY,SAAS,QAAQ,QAAQ,GAAG,QAAQ;AAAA,IAC3D,SAAS,YAAY;AACjB,aAAQ,MAAM,YAAY,OAAO,MAAM;AAAA,QACnC;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ,CAAC;AACL;",
6
6
  "names": ["import_react"]
7
7
  }
@@ -62,7 +62,7 @@ var import_react = require("react");
62
62
  var import_jsx_runtime = require("react/jsx-runtime");
63
63
  var IotaClientContext = (0, import_react.createContext)(null);
64
64
  var DEFAULT_NETWORKS = {
65
- localnet: { url: (0, import_client.getNetwork)(import_client.Network.Local).url }
65
+ localnet: { url: (0, import_client.getNetwork)(import_client.Network.Localnet).url }
66
66
  };
67
67
 
68
68
  // src/hooks/useIotaClient.ts
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/hooks/wallet/useSignAndExecuteTransaction.ts", "../../../../src/constants/walletMutationKeys.ts", "../../../../src/errors/walletErrors.ts", "../../../../src/hooks/useIotaClient.ts", "../../../../src/components/IotaClientProvider.tsx", "../../../../src/hooks/wallet/useWalletStore.ts", "../../../../src/contexts/walletContext.ts", "../../../../src/hooks/wallet/useCurrentAccount.ts", "../../../../src/hooks/wallet/useCurrentWallet.ts", "../../../../src/hooks/wallet/useReportTransactionEffects.ts"],
4
- "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction } from '@iota/iota-sdk/transactions';\nimport { toB64 } from '@iota/iota-sdk/utils';\nimport type {\n IotaSignAndExecuteTransactionInput,\n IotaSignAndExecuteTransactionOutput,\n} from '@iota/wallet-standard';\nimport { signTransaction } from '@iota/wallet-standard';\nimport type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { walletMutationKeys } from '../../constants/walletMutationKeys.js';\nimport {\n WalletFeatureNotSupportedError,\n WalletNoAccountSelectedError,\n WalletNotConnectedError,\n} from '../../errors/walletErrors.js';\nimport type { PartialBy } from '../../types/utilityTypes.js';\nimport { useIotaClient } from '../useIotaClient.js';\nimport { useCurrentAccount } from './useCurrentAccount.js';\nimport { useCurrentWallet } from './useCurrentWallet.js';\nimport { useReportTransactionEffects } from './useReportTransactionEffects.js';\n\ntype UseSignAndExecuteTransactionArgs = PartialBy<\n Omit<IotaSignAndExecuteTransactionInput, 'transaction'>,\n 'account' | 'chain'\n> & {\n transaction: Transaction | string;\n};\n\ntype UseSignAndExecuteTransactionResult = IotaSignAndExecuteTransactionOutput;\n\ntype UseSignAndExecuteTransactionError =\n | WalletFeatureNotSupportedError\n | WalletNoAccountSelectedError\n | WalletNotConnectedError\n | Error;\n\ntype ExecuteTransactionResult =\n | {\n digest: string;\n rawEffects?: number[];\n }\n | {\n effects?: {\n bcs?: string;\n };\n };\n\ntype UseSignAndExecuteTransactionMutationOptions<Result extends ExecuteTransactionResult> = Omit<\n UseMutationOptions<\n Result,\n UseSignAndExecuteTransactionError,\n UseSignAndExecuteTransactionArgs,\n unknown\n >,\n 'mutationFn'\n> & {\n execute?: ({ bytes, signature }: { bytes: string; signature: string }) => Promise<Result>;\n};\n\n/**\n * Mutation hook for prompting the user to sign and execute a transaction.\n */\nexport function useSignAndExecuteTransaction<\n Result extends ExecuteTransactionResult = UseSignAndExecuteTransactionResult,\n>({\n mutationKey,\n execute,\n ...mutationOptions\n}: UseSignAndExecuteTransactionMutationOptions<Result> = {}): UseMutationResult<\n Result,\n UseSignAndExecuteTransactionError,\n UseSignAndExecuteTransactionArgs\n> {\n const { currentWallet, supportedIntents } = useCurrentWallet();\n const currentAccount = useCurrentAccount();\n const client = useIotaClient();\n const { mutate: reportTransactionEffects } = useReportTransactionEffects();\n\n const executeTransaction: ({\n bytes,\n signature,\n }: {\n bytes: string;\n signature: string;\n }) => Promise<ExecuteTransactionResult> =\n execute ??\n (async ({ bytes, signature }) => {\n const { digest, rawEffects } = await client.executeTransactionBlock({\n transactionBlock: bytes,\n signature,\n options: {\n showRawEffects: true,\n },\n });\n\n return {\n digest,\n rawEffects,\n effects: toB64(new Uint8Array(rawEffects!)),\n bytes,\n signature,\n };\n });\n\n return useMutation({\n mutationKey: walletMutationKeys.signAndExecuteTransaction(mutationKey),\n mutationFn: async ({ transaction, ...signTransactionArgs }): Promise<Result> => {\n if (!currentWallet) {\n throw new WalletNotConnectedError('No wallet is connected.');\n }\n\n const signerAccount = signTransactionArgs.account ?? currentAccount;\n if (!signerAccount) {\n throw new WalletNoAccountSelectedError(\n 'No wallet account is selected to sign the transaction with.',\n );\n }\n const chain = signTransactionArgs.chain ?? signerAccount?.chains[0];\n\n if (!currentWallet.features['iota:signTransaction']) {\n throw new WalletFeatureNotSupportedError(\n \"This wallet doesn't support the `signTransaction` feature.\",\n );\n }\n\n const { signature, bytes } = await signTransaction(currentWallet, {\n ...signTransactionArgs,\n transaction: {\n async toJSON() {\n return typeof transaction === 'string'\n ? transaction\n : await transaction.toJSON({\n supportedIntents,\n client,\n });\n },\n },\n account: signerAccount,\n chain: signTransactionArgs.chain ?? signerAccount.chains[0],\n });\n\n const result = await executeTransaction({ bytes, signature });\n\n let effects: string;\n\n if ('effects' in result && result.effects?.bcs) {\n effects = result.effects.bcs;\n } else if ('rawEffects' in result) {\n effects = toB64(new Uint8Array(result.rawEffects!));\n } else {\n throw new Error('Could not parse effects from transaction result.');\n }\n\n reportTransactionEffects({ effects, account: signerAccount, chain });\n\n return result as Result;\n },\n ...mutationOptions,\n });\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { MutationKey } from '@tanstack/react-query';\n\nexport const walletMutationKeys = {\n all: { baseScope: 'wallet' },\n connectWallet: formMutationKeyFn('connect-wallet'),\n autoconnectWallet: formMutationKeyFn('autoconnect-wallet'),\n disconnectWallet: formMutationKeyFn('disconnect-wallet'),\n signPersonalMessage: formMutationKeyFn('sign-personal-message'),\n signTransaction: formMutationKeyFn('sign-transaction'),\n signAndExecuteTransaction: formMutationKeyFn('sign-and-execute-transaction'),\n switchAccount: formMutationKeyFn('switch-account'),\n reportTransactionEffects: formMutationKeyFn('report-transaction-effects'),\n};\n\nfunction formMutationKeyFn(baseEntity: string) {\n return function mutationKeyFn(additionalKeys: MutationKey = []) {\n return [{ ...walletMutationKeys.all, baseEntity }, ...additionalKeys];\n };\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * An error that is instantiated when someone attempts to perform an action that requires an active wallet connection.\n */\nexport class WalletNotConnectedError extends Error {}\n\n/**\n * An error that is instantiated when someone attempts to perform an action that requires a selected wallet account.\n * This is more of an edge case stemming from the fact that wallets don't technically require you to authorize any\n * accounts when connecting a wallet.\n */\nexport class WalletNoAccountSelectedError extends Error {}\n\n/**\n * An error that is instantiated when someone attempts to perform an action that isn't supported by a wallet.\n */\nexport class WalletFeatureNotSupportedError extends Error {}\n\n/**\n * An error that is instantiated when a wallet account can't be found for a specific wallet.\n */\nexport class WalletAccountNotFoundError extends Error {}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { useContext } from 'react';\n\nimport { IotaClientContext } from '../components/IotaClientProvider.js';\n\nexport function useIotaClientContext() {\n const iotaClient = useContext(IotaClientContext);\n\n if (!iotaClient) {\n throw new Error(\n 'Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider',\n );\n }\n\n return iotaClient;\n}\n\nexport function useIotaClient(): IotaClient {\n return useIotaClientContext().client;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getNetwork, isIotaClient, Network, IotaClient } from '@iota/iota-sdk/client';\nimport type { IotaClientOptions } from '@iota/iota-sdk/client';\nimport { createContext, useMemo, useState } from 'react';\n\nimport type { NetworkConfig } from '../hooks/networkConfig.js';\n\ntype NetworkConfigs<T extends NetworkConfig | IotaClient = NetworkConfig | IotaClient> = Record<\n string,\n T\n>;\n\nexport interface IotaClientProviderContext {\n client: IotaClient;\n networks: NetworkConfigs;\n network: string;\n config: NetworkConfig | null;\n selectNetwork: (network: string) => void;\n}\n\nexport const IotaClientContext = createContext<IotaClientProviderContext | null>(null);\n\nexport type IotaClientProviderProps<T extends NetworkConfigs> = {\n createClient?: (name: keyof T, config: T[keyof T]) => IotaClient;\n children: React.ReactNode;\n networks?: T;\n onNetworkChange?: (network: keyof T & string) => void;\n} & (\n | {\n defaultNetwork?: keyof T & string;\n network?: never;\n }\n | {\n defaultNetwork?: never;\n network?: keyof T & string;\n }\n);\n\nconst DEFAULT_NETWORKS = {\n localnet: { url: getNetwork(Network.Local).url },\n};\n\nconst DEFAULT_CREATE_CLIENT = function createClient(\n _name: string,\n config: NetworkConfig | IotaClient,\n) {\n if (isIotaClient(config)) {\n return config;\n }\n\n return new IotaClient(config);\n};\n\nexport function IotaClientProvider<T extends NetworkConfigs>(props: IotaClientProviderProps<T>) {\n const { onNetworkChange, network, children } = props;\n const networks = (props.networks ?? DEFAULT_NETWORKS) as T;\n const createClient =\n (props.createClient as typeof DEFAULT_CREATE_CLIENT) ?? DEFAULT_CREATE_CLIENT;\n\n const [selectedNetwork, setSelectedNetwork] = useState<keyof T & string>(\n props.network ?? props.defaultNetwork ?? (Object.keys(networks)[0] as keyof T & string),\n );\n\n const currentNetwork = props.network ?? selectedNetwork;\n\n const client = useMemo(() => {\n return createClient(currentNetwork, networks[currentNetwork]);\n }, [createClient, currentNetwork, networks]);\n\n const ctx = useMemo((): IotaClientProviderContext => {\n return {\n client,\n networks,\n network: currentNetwork,\n config:\n networks[currentNetwork] instanceof IotaClient\n ? null\n : (networks[currentNetwork] as IotaClientOptions),\n selectNetwork: (newNetwork) => {\n if (currentNetwork === newNetwork) {\n return;\n }\n\n if (!network && newNetwork !== selectedNetwork) {\n setSelectedNetwork(newNetwork);\n }\n\n onNetworkChange?.(newNetwork);\n },\n };\n }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);\n\n return <IotaClientContext.Provider value={ctx}>{children}</IotaClientContext.Provider>;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useContext } from 'react';\nimport { useStore } from 'zustand';\n\nimport { WalletContext } from '../../contexts/walletContext.js';\nimport type { StoreState } from '../../walletStore.js';\n\nexport function useWalletStore<T>(selector: (state: StoreState) => T): T {\n const store = useContext(WalletContext);\n if (!store) {\n throw new Error(\n 'Could not find WalletContext. Ensure that you have set up the WalletProvider.',\n );\n }\n return useStore(store, selector);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { createContext } from 'react';\n\nimport type { WalletStore } from '../walletStore.js';\n\nexport const WalletContext = createContext<WalletStore | null>(null);\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { WalletAccount } from '@iota/wallet-standard';\n\nimport { useWalletStore } from './useWalletStore.js';\n\n/**\n * Retrieves the wallet account that is currently selected, if one exists.\n */\nexport function useCurrentAccount(): WalletAccount | null {\n return useWalletStore((state) => state.currentAccount);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useWalletStore } from './useWalletStore.js';\n\n/**\n * Retrieves the wallet that is currently connected to the dApp, if one exists.\n */\nexport function useCurrentWallet() {\n const currentWallet = useWalletStore((state) => state.currentWallet);\n const connectionStatus = useWalletStore((state) => state.connectionStatus);\n const supportedIntents = useWalletStore((state) => state.supportedIntents);\n\n switch (connectionStatus) {\n case 'connecting':\n return {\n connectionStatus,\n currentWallet: null,\n isDisconnected: false,\n isConnecting: true,\n isConnected: false,\n supportedIntents: [],\n } as const;\n case 'disconnected':\n return {\n connectionStatus,\n currentWallet: null,\n isDisconnected: true,\n isConnecting: false,\n isConnected: false,\n supportedIntents: [],\n } as const;\n case 'connected': {\n return {\n connectionStatus,\n currentWallet: currentWallet!,\n isDisconnected: false,\n isConnecting: false,\n isConnected: true,\n supportedIntents,\n } as const;\n }\n }\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { toB64 } from '@iota/iota-sdk/utils';\nimport type { IotaReportTransactionEffectsInput } from '@iota/wallet-standard';\nimport type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { walletMutationKeys } from '../../constants/walletMutationKeys.js';\nimport type { WalletFeatureNotSupportedError } from '../../errors/walletErrors.js';\nimport {\n WalletNoAccountSelectedError,\n WalletNotConnectedError,\n} from '../../errors/walletErrors.js';\nimport type { PartialBy } from '../../types/utilityTypes.js';\nimport { useCurrentAccount } from './useCurrentAccount.js';\nimport { useCurrentWallet } from './useCurrentWallet.js';\n\ntype UseReportTransactionEffectsArgs = Omit<\n PartialBy<IotaReportTransactionEffectsInput, 'account' | 'chain'>,\n 'effects'\n> & {\n effects: string | number[];\n};\n\ntype UseReportTransactionEffectsError =\n | WalletFeatureNotSupportedError\n | WalletNoAccountSelectedError\n | WalletNotConnectedError\n | Error;\n\ntype UseReportTransactionEffectsMutationOptions = Omit<\n UseMutationOptions<\n void,\n UseReportTransactionEffectsError,\n UseReportTransactionEffectsArgs,\n unknown\n >,\n 'mutationFn'\n>;\n\n/**\n * Mutation hook for prompting the user to sign a message.\n */\nexport function useReportTransactionEffects({\n mutationKey,\n ...mutationOptions\n}: UseReportTransactionEffectsMutationOptions = {}): UseMutationResult<\n void,\n UseReportTransactionEffectsError,\n UseReportTransactionEffectsArgs\n> {\n const { currentWallet } = useCurrentWallet();\n const currentAccount = useCurrentAccount();\n\n return useMutation({\n mutationKey: walletMutationKeys.reportTransactionEffects(mutationKey),\n mutationFn: async ({\n effects,\n chain = currentWallet?.chains[0],\n account = currentAccount,\n }) => {\n if (!currentWallet) {\n throw new WalletNotConnectedError('No wallet is connected.');\n }\n\n if (!account) {\n throw new WalletNoAccountSelectedError(\n 'No wallet account is selected to report transaction effects for',\n );\n }\n\n const reportTransactionEffectsFeature =\n currentWallet.features['iota:reportTransactionEffects'];\n\n if (reportTransactionEffectsFeature) {\n return await reportTransactionEffectsFeature.reportTransactionEffects({\n effects: Array.isArray(effects) ? toB64(new Uint8Array(effects)) : effects,\n account,\n chain: chain ?? currentWallet?.chains[0],\n });\n }\n },\n ...mutationOptions,\n });\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,IAAAA,gBAAsB;AAKtB,6BAAgC;AAEhC,IAAAC,sBAA4B;;;ACNrB,IAAM,qBAAqB;AAAA,EAC9B,KAAK,EAAE,WAAW,SAAS;AAAA,EAC3B,eAAe,kBAAkB,gBAAgB;AAAA,EACjD,mBAAmB,kBAAkB,oBAAoB;AAAA,EACzD,kBAAkB,kBAAkB,mBAAmB;AAAA,EACvD,qBAAqB,kBAAkB,uBAAuB;AAAA,EAC9D,iBAAiB,kBAAkB,kBAAkB;AAAA,EACrD,2BAA2B,kBAAkB,8BAA8B;AAAA,EAC3E,eAAe,kBAAkB,gBAAgB;AAAA,EACjD,0BAA0B,kBAAkB,4BAA4B;AAC5E;AAEA,SAAS,kBAAkB,YAAoB;AAC3C,SAAO,SAAS,cAAc,iBAA8B,CAAC,GAAG;AAC5D,WAAO,CAAC,EAAE,GAAG,mBAAmB,KAAK,WAAW,GAAG,GAAG,cAAc;AAAA,EACxE;AACJ;;;ACfO,IAAM,0BAAN,cAAsC,MAAM;AAAC;AAO7C,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5D,UAAI;AAEJ,UAAI,aAAa,UAAU,OAAO,SAAS,KAAK;AAC5C,kBAAU,OAAO,QAAQ;AAAA,MAC7B,WAAW,gBAAgB,QAAQ;AAC/B,sBAAU,qBAAM,IAAI,WAAW,OAAO,UAAW,CAAC;AAAA,MACtD,OAAO;AACH,cAAM,IAAI,MAAM,kDAAkD;AAAA,MACtE;AAEA,+BAAyB,EAAE,SAAS,SAAS,eAAe,MAAM,CAAC;AAEnE,aAAO;AAAA,IACX;AAAA,IACA,GAAG;AAAA,EACP,CAAC;AACL;",
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction } from '@iota/iota-sdk/transactions';\nimport { toB64 } from '@iota/iota-sdk/utils';\nimport type {\n IotaSignAndExecuteTransactionInput,\n IotaSignAndExecuteTransactionOutput,\n} from '@iota/wallet-standard';\nimport { signTransaction } from '@iota/wallet-standard';\nimport type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { walletMutationKeys } from '../../constants/walletMutationKeys.js';\nimport {\n WalletFeatureNotSupportedError,\n WalletNoAccountSelectedError,\n WalletNotConnectedError,\n} from '../../errors/walletErrors.js';\nimport type { PartialBy } from '../../types/utilityTypes.js';\nimport { useIotaClient } from '../useIotaClient.js';\nimport { useCurrentAccount } from './useCurrentAccount.js';\nimport { useCurrentWallet } from './useCurrentWallet.js';\nimport { useReportTransactionEffects } from './useReportTransactionEffects.js';\n\ntype UseSignAndExecuteTransactionArgs = PartialBy<\n Omit<IotaSignAndExecuteTransactionInput, 'transaction'>,\n 'account' | 'chain'\n> & {\n transaction: Transaction | string;\n};\n\ntype UseSignAndExecuteTransactionResult = IotaSignAndExecuteTransactionOutput;\n\ntype UseSignAndExecuteTransactionError =\n | WalletFeatureNotSupportedError\n | WalletNoAccountSelectedError\n | WalletNotConnectedError\n | Error;\n\ntype ExecuteTransactionResult =\n | {\n digest: string;\n rawEffects?: number[];\n }\n | {\n effects?: {\n bcs?: string;\n };\n };\n\ntype UseSignAndExecuteTransactionMutationOptions<Result extends ExecuteTransactionResult> = Omit<\n UseMutationOptions<\n Result,\n UseSignAndExecuteTransactionError,\n UseSignAndExecuteTransactionArgs,\n unknown\n >,\n 'mutationFn'\n> & {\n execute?: ({ bytes, signature }: { bytes: string; signature: string }) => Promise<Result>;\n};\n\n/**\n * Mutation hook for prompting the user to sign and execute a transaction.\n */\nexport function useSignAndExecuteTransaction<\n Result extends ExecuteTransactionResult = UseSignAndExecuteTransactionResult,\n>({\n mutationKey,\n execute,\n ...mutationOptions\n}: UseSignAndExecuteTransactionMutationOptions<Result> = {}): UseMutationResult<\n Result,\n UseSignAndExecuteTransactionError,\n UseSignAndExecuteTransactionArgs\n> {\n const { currentWallet, supportedIntents } = useCurrentWallet();\n const currentAccount = useCurrentAccount();\n const client = useIotaClient();\n const { mutate: reportTransactionEffects } = useReportTransactionEffects();\n\n const executeTransaction: ({\n bytes,\n signature,\n }: {\n bytes: string;\n signature: string;\n }) => Promise<ExecuteTransactionResult> =\n execute ??\n (async ({ bytes, signature }) => {\n const { digest, rawEffects } = await client.executeTransactionBlock({\n transactionBlock: bytes,\n signature,\n options: {\n showRawEffects: true,\n },\n });\n\n return {\n digest,\n rawEffects,\n effects: toB64(new Uint8Array(rawEffects!)),\n bytes,\n signature,\n };\n });\n\n return useMutation({\n mutationKey: walletMutationKeys.signAndExecuteTransaction(mutationKey),\n mutationFn: async ({ transaction, ...signTransactionArgs }): Promise<Result> => {\n if (!currentWallet) {\n throw new WalletNotConnectedError('No wallet is connected.');\n }\n\n const signerAccount = signTransactionArgs.account ?? currentAccount;\n if (!signerAccount) {\n throw new WalletNoAccountSelectedError(\n 'No wallet account is selected to sign the transaction with.',\n );\n }\n const chain = signTransactionArgs.chain ?? signerAccount?.chains[0];\n\n if (!currentWallet.features['iota:signTransaction']) {\n throw new WalletFeatureNotSupportedError(\n \"This wallet doesn't support the `signTransaction` feature.\",\n );\n }\n\n const { signature, bytes } = await signTransaction(currentWallet, {\n ...signTransactionArgs,\n transaction: {\n async toJSON() {\n return typeof transaction === 'string'\n ? transaction\n : await transaction.toJSON({\n supportedIntents,\n client,\n });\n },\n },\n account: signerAccount,\n chain: signTransactionArgs.chain ?? signerAccount.chains[0],\n });\n\n const result = await executeTransaction({ bytes, signature });\n\n let effects: string;\n\n if ('effects' in result && result.effects?.bcs) {\n effects = result.effects.bcs;\n } else if ('rawEffects' in result) {\n effects = toB64(new Uint8Array(result.rawEffects!));\n } else {\n throw new Error('Could not parse effects from transaction result.');\n }\n\n reportTransactionEffects({ effects, account: signerAccount, chain });\n\n return result as Result;\n },\n ...mutationOptions,\n });\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { MutationKey } from '@tanstack/react-query';\n\nexport const walletMutationKeys = {\n all: { baseScope: 'wallet' },\n connectWallet: formMutationKeyFn('connect-wallet'),\n autoconnectWallet: formMutationKeyFn('autoconnect-wallet'),\n disconnectWallet: formMutationKeyFn('disconnect-wallet'),\n signPersonalMessage: formMutationKeyFn('sign-personal-message'),\n signTransaction: formMutationKeyFn('sign-transaction'),\n signAndExecuteTransaction: formMutationKeyFn('sign-and-execute-transaction'),\n switchAccount: formMutationKeyFn('switch-account'),\n reportTransactionEffects: formMutationKeyFn('report-transaction-effects'),\n};\n\nfunction formMutationKeyFn(baseEntity: string) {\n return function mutationKeyFn(additionalKeys: MutationKey = []) {\n return [{ ...walletMutationKeys.all, baseEntity }, ...additionalKeys];\n };\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * An error that is instantiated when someone attempts to perform an action that requires an active wallet connection.\n */\nexport class WalletNotConnectedError extends Error {}\n\n/**\n * An error that is instantiated when someone attempts to perform an action that requires a selected wallet account.\n * This is more of an edge case stemming from the fact that wallets don't technically require you to authorize any\n * accounts when connecting a wallet.\n */\nexport class WalletNoAccountSelectedError extends Error {}\n\n/**\n * An error that is instantiated when someone attempts to perform an action that isn't supported by a wallet.\n */\nexport class WalletFeatureNotSupportedError extends Error {}\n\n/**\n * An error that is instantiated when a wallet account can't be found for a specific wallet.\n */\nexport class WalletAccountNotFoundError extends Error {}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { useContext } from 'react';\n\nimport { IotaClientContext } from '../components/IotaClientProvider.js';\n\nexport function useIotaClientContext() {\n const iotaClient = useContext(IotaClientContext);\n\n if (!iotaClient) {\n throw new Error(\n 'Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider',\n );\n }\n\n return iotaClient;\n}\n\nexport function useIotaClient(): IotaClient {\n return useIotaClientContext().client;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getNetwork, isIotaClient, Network, IotaClient } from '@iota/iota-sdk/client';\nimport type { IotaClientOptions } from '@iota/iota-sdk/client';\nimport { createContext, useMemo, useState } from 'react';\n\nimport type { NetworkConfig } from '../hooks/networkConfig.js';\n\ntype NetworkConfigs<T extends NetworkConfig | IotaClient = NetworkConfig | IotaClient> = Record<\n string,\n T\n>;\n\nexport interface IotaClientProviderContext {\n client: IotaClient;\n networks: NetworkConfigs;\n network: string;\n config: NetworkConfig | null;\n selectNetwork: (network: string) => void;\n}\n\nexport const IotaClientContext = createContext<IotaClientProviderContext | null>(null);\n\nexport type IotaClientProviderProps<T extends NetworkConfigs> = {\n createClient?: (name: keyof T, config: T[keyof T]) => IotaClient;\n children: React.ReactNode;\n networks?: T;\n onNetworkChange?: (network: keyof T & string) => void;\n} & (\n | {\n defaultNetwork?: keyof T & string;\n network?: never;\n }\n | {\n defaultNetwork?: never;\n network?: keyof T & string;\n }\n);\n\nconst DEFAULT_NETWORKS = {\n localnet: { url: getNetwork(Network.Localnet).url },\n};\n\nconst DEFAULT_CREATE_CLIENT = function createClient(\n _name: string,\n config: NetworkConfig | IotaClient,\n) {\n if (isIotaClient(config)) {\n return config;\n }\n\n return new IotaClient(config);\n};\n\nexport function IotaClientProvider<T extends NetworkConfigs>(props: IotaClientProviderProps<T>) {\n const { onNetworkChange, network, children } = props;\n const networks = (props.networks ?? DEFAULT_NETWORKS) as T;\n const createClient =\n (props.createClient as typeof DEFAULT_CREATE_CLIENT) ?? DEFAULT_CREATE_CLIENT;\n\n const [selectedNetwork, setSelectedNetwork] = useState<keyof T & string>(\n props.network ?? props.defaultNetwork ?? (Object.keys(networks)[0] as keyof T & string),\n );\n\n const currentNetwork = props.network ?? selectedNetwork;\n\n const client = useMemo(() => {\n return createClient(currentNetwork, networks[currentNetwork]);\n }, [createClient, currentNetwork, networks]);\n\n const ctx = useMemo((): IotaClientProviderContext => {\n return {\n client,\n networks,\n network: currentNetwork,\n config:\n networks[currentNetwork] instanceof IotaClient\n ? null\n : (networks[currentNetwork] as IotaClientOptions),\n selectNetwork: (newNetwork) => {\n if (currentNetwork === newNetwork) {\n return;\n }\n\n if (!network && newNetwork !== selectedNetwork) {\n setSelectedNetwork(newNetwork);\n }\n\n onNetworkChange?.(newNetwork);\n },\n };\n }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);\n\n return <IotaClientContext.Provider value={ctx}>{children}</IotaClientContext.Provider>;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useContext } from 'react';\nimport { useStore } from 'zustand';\n\nimport { WalletContext } from '../../contexts/walletContext.js';\nimport type { StoreState } from '../../walletStore.js';\n\nexport function useWalletStore<T>(selector: (state: StoreState) => T): T {\n const store = useContext(WalletContext);\n if (!store) {\n throw new Error(\n 'Could not find WalletContext. Ensure that you have set up the WalletProvider.',\n );\n }\n return useStore(store, selector);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { createContext } from 'react';\n\nimport type { WalletStore } from '../walletStore.js';\n\nexport const WalletContext = createContext<WalletStore | null>(null);\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { WalletAccount } from '@iota/wallet-standard';\n\nimport { useWalletStore } from './useWalletStore.js';\n\n/**\n * Retrieves the wallet account that is currently selected, if one exists.\n */\nexport function useCurrentAccount(): WalletAccount | null {\n return useWalletStore((state) => state.currentAccount);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useWalletStore } from './useWalletStore.js';\n\n/**\n * Retrieves the wallet that is currently connected to the dApp, if one exists.\n */\nexport function useCurrentWallet() {\n const currentWallet = useWalletStore((state) => state.currentWallet);\n const connectionStatus = useWalletStore((state) => state.connectionStatus);\n const supportedIntents = useWalletStore((state) => state.supportedIntents);\n\n switch (connectionStatus) {\n case 'connecting':\n return {\n connectionStatus,\n currentWallet: null,\n isDisconnected: false,\n isConnecting: true,\n isConnected: false,\n supportedIntents: [],\n } as const;\n case 'disconnected':\n return {\n connectionStatus,\n currentWallet: null,\n isDisconnected: true,\n isConnecting: false,\n isConnected: false,\n supportedIntents: [],\n } as const;\n case 'connected': {\n return {\n connectionStatus,\n currentWallet: currentWallet!,\n isDisconnected: false,\n isConnecting: false,\n isConnected: true,\n supportedIntents,\n } as const;\n }\n }\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { toB64 } from '@iota/iota-sdk/utils';\nimport type { IotaReportTransactionEffectsInput } from '@iota/wallet-standard';\nimport type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { walletMutationKeys } from '../../constants/walletMutationKeys.js';\nimport type { WalletFeatureNotSupportedError } from '../../errors/walletErrors.js';\nimport {\n WalletNoAccountSelectedError,\n WalletNotConnectedError,\n} from '../../errors/walletErrors.js';\nimport type { PartialBy } from '../../types/utilityTypes.js';\nimport { useCurrentAccount } from './useCurrentAccount.js';\nimport { useCurrentWallet } from './useCurrentWallet.js';\n\ntype UseReportTransactionEffectsArgs = Omit<\n PartialBy<IotaReportTransactionEffectsInput, 'account' | 'chain'>,\n 'effects'\n> & {\n effects: string | number[];\n};\n\ntype UseReportTransactionEffectsError =\n | WalletFeatureNotSupportedError\n | WalletNoAccountSelectedError\n | WalletNotConnectedError\n | Error;\n\ntype UseReportTransactionEffectsMutationOptions = Omit<\n UseMutationOptions<\n void,\n UseReportTransactionEffectsError,\n UseReportTransactionEffectsArgs,\n unknown\n >,\n 'mutationFn'\n>;\n\n/**\n * Mutation hook for prompting the user to sign a message.\n */\nexport function useReportTransactionEffects({\n mutationKey,\n ...mutationOptions\n}: UseReportTransactionEffectsMutationOptions = {}): UseMutationResult<\n void,\n UseReportTransactionEffectsError,\n UseReportTransactionEffectsArgs\n> {\n const { currentWallet } = useCurrentWallet();\n const currentAccount = useCurrentAccount();\n\n return useMutation({\n mutationKey: walletMutationKeys.reportTransactionEffects(mutationKey),\n mutationFn: async ({\n effects,\n chain = currentWallet?.chains[0],\n account = currentAccount,\n }) => {\n if (!currentWallet) {\n throw new WalletNotConnectedError('No wallet is connected.');\n }\n\n if (!account) {\n throw new WalletNoAccountSelectedError(\n 'No wallet account is selected to report transaction effects for',\n );\n }\n\n const reportTransactionEffectsFeature =\n currentWallet.features['iota:reportTransactionEffects'];\n\n if (reportTransactionEffectsFeature) {\n return await reportTransactionEffectsFeature.reportTransactionEffects({\n effects: Array.isArray(effects)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AAa,mBAAmB,0BAA0B,WAAW;AAAA,IACrE,YAAY,OAAO,EAAE,aAAa,GAAG,oBAAoB,MAAuB;AAC5E,UAAI,CAAC,eAAe;AAChB,cAAM,IAAI,wBAAwB,yBAAyB;AAAA,MAC/D;AAEA,YAAM,gBAAgB,oBAAoB,WAAW;AACrD,UAAI,CAAC,eAAe;AAChB,cAAM,IAAI;AAAA,UACN;AAAA,QACJ;AAAA,MACJ;AACA,YAAM,QAAQ,oBAAoB,SAAS,eAAe,OAAO,CAAC;AAElE,UAAI,CAAC,cAAc,SAAS,sBAAsB,GAAG;AACjD,cAAM,IAAI;AAAA,UACN;AAAA,QACJ;AAAA,MACJ;AAEA,YAAM,EAAE,WAAW,MAAM,IAAI,UAAM,wCAAgB,eAAe;AAAA,QAC9D,GAAG;AAAA,QACH,aAAa;AAAA,UACT,MAAM,SAAS;AACX,mBAAO,OAAO,gBAAgB,WACxB,cACA,MAAM,YAAY,OAAO;AAAA,cACrB;AAAA,cACA;AAAA,YACJ,CAAC;AAAA,UACX;AAAA,QACJ;AAAA,QACA,SAAS;AAAA,QACT,OAAO,oBAAoB,SAAS,cAAc,OAAO,CAAC;AAAA,MAC9D,CAAC;AAED,YAAM,SAAS,MAAM,mBAAmB,EAAE,OAAO,UAAU,CAAC;AAE5D,UAAI;AAEJ,UAAI,aAAa,UAAU,OAAO,SAAS,KAAK;AAC5C,kBAAU,OAAO,QAAQ;AAAA,MAC7B,WAAW,gBAAgB,QAAQ;AAC/B,sBAAU,qBAAM,IAAI,WAAW,OAAO,UAAW,CAAC;AAAA,MACtD,OAAO;AACH,cAAM,IAAI,MAAM,kDAAkD;AAAA,MACtE;AAEA,+BAAyB,EAAE,SAAS,SAAS,eAAe,MAAM,CAAC;AAEnE,aAAO;AAAA,IACX;AAAA,IACA,GAAG;AAAA,EACP,CAAC;AACL;",
6
6
  "names": ["import_utils", "import_react_query", "import_react", "import_react", "import_react"]
7
7
  }
@@ -61,7 +61,7 @@ var import_react = require("react");
61
61
  var import_jsx_runtime = require("react/jsx-runtime");
62
62
  var IotaClientContext = (0, import_react.createContext)(null);
63
63
  var DEFAULT_NETWORKS = {
64
- localnet: { url: (0, import_client.getNetwork)(import_client.Network.Local).url }
64
+ localnet: { url: (0, import_client.getNetwork)(import_client.Network.Localnet).url }
65
65
  };
66
66
 
67
67
  // src/hooks/useIotaClient.ts
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/hooks/wallet/useSignTransaction.ts", "../../../../src/constants/walletMutationKeys.ts", "../../../../src/errors/walletErrors.ts", "../../../../src/hooks/useIotaClient.ts", "../../../../src/components/IotaClientProvider.tsx", "../../../../src/hooks/wallet/useWalletStore.ts", "../../../../src/contexts/walletContext.ts", "../../../../src/hooks/wallet/useCurrentAccount.ts", "../../../../src/hooks/wallet/useCurrentWallet.ts", "../../../../src/hooks/wallet/useReportTransactionEffects.ts"],
4
- "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction } from '@iota/iota-sdk/transactions';\nimport { signTransaction } from '@iota/wallet-standard';\nimport type { SignedTransaction, IotaSignTransactionInput } from '@iota/wallet-standard';\nimport type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { walletMutationKeys } from '../../constants/walletMutationKeys.js';\nimport {\n WalletFeatureNotSupportedError,\n WalletNoAccountSelectedError,\n WalletNotConnectedError,\n} from '../../errors/walletErrors.js';\nimport type { PartialBy } from '../../types/utilityTypes.js';\nimport { useIotaClient } from '../useIotaClient.js';\nimport { useCurrentAccount } from './useCurrentAccount.js';\nimport { useCurrentWallet } from './useCurrentWallet.js';\nimport { useReportTransactionEffects } from './useReportTransactionEffects.js';\n\ntype UseSignTransactionArgs = PartialBy<\n Omit<IotaSignTransactionInput, 'transaction'>,\n 'account' | 'chain'\n> & {\n transaction: Transaction | string;\n};\n\ninterface UseSignTransactionResult extends SignedTransaction {\n reportTransactionEffects: (effects: string) => void;\n}\n\ntype UseSignTransactionError =\n | WalletFeatureNotSupportedError\n | WalletNoAccountSelectedError\n | WalletNotConnectedError\n | Error;\n\ntype UseSignTransactionMutationOptions = Omit<\n UseMutationOptions<\n UseSignTransactionResult,\n UseSignTransactionError,\n UseSignTransactionArgs,\n unknown\n >,\n 'mutationFn'\n>;\n\n/**\n * Mutation hook for prompting the user to sign a transaction.\n */\nexport function useSignTransaction({\n mutationKey,\n ...mutationOptions\n}: UseSignTransactionMutationOptions = {}): UseMutationResult<\n UseSignTransactionResult,\n UseSignTransactionError,\n UseSignTransactionArgs\n> {\n const { currentWallet } = useCurrentWallet();\n const currentAccount = useCurrentAccount();\n const client = useIotaClient();\n\n const { mutate: reportTransactionEffects } = useReportTransactionEffects();\n\n return useMutation({\n mutationKey: walletMutationKeys.signTransaction(mutationKey),\n mutationFn: async ({ transaction, ...signTransactionArgs }) => {\n if (!currentWallet) {\n throw new WalletNotConnectedError('No wallet is connected.');\n }\n\n const signerAccount = signTransactionArgs.account ?? currentAccount;\n if (!signerAccount) {\n throw new WalletNoAccountSelectedError(\n 'No wallet account is selected to sign the transaction with.',\n );\n }\n\n if (!currentWallet.features['iota:signTransaction']) {\n throw new WalletFeatureNotSupportedError(\n \"This wallet doesn't support the `signTransaction` feature.\",\n );\n }\n\n const { bytes, signature } = await signTransaction(currentWallet, {\n ...signTransactionArgs,\n transaction: {\n toJSON: async () => {\n return typeof transaction === 'string'\n ? transaction\n : await transaction.toJSON({\n supportedIntents: [],\n client,\n });\n },\n },\n account: signerAccount,\n chain: signTransactionArgs.chain ?? signerAccount.chains[0],\n });\n\n return {\n bytes,\n signature,\n reportTransactionEffects: (effects) => {\n reportTransactionEffects({\n effects,\n account: signerAccount,\n chain: signTransactionArgs.chain ?? signerAccount.chains[0],\n });\n },\n };\n },\n ...mutationOptions,\n });\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { MutationKey } from '@tanstack/react-query';\n\nexport const walletMutationKeys = {\n all: { baseScope: 'wallet' },\n connectWallet: formMutationKeyFn('connect-wallet'),\n autoconnectWallet: formMutationKeyFn('autoconnect-wallet'),\n disconnectWallet: formMutationKeyFn('disconnect-wallet'),\n signPersonalMessage: formMutationKeyFn('sign-personal-message'),\n signTransaction: formMutationKeyFn('sign-transaction'),\n signAndExecuteTransaction: formMutationKeyFn('sign-and-execute-transaction'),\n switchAccount: formMutationKeyFn('switch-account'),\n reportTransactionEffects: formMutationKeyFn('report-transaction-effects'),\n};\n\nfunction formMutationKeyFn(baseEntity: string) {\n return function mutationKeyFn(additionalKeys: MutationKey = []) {\n return [{ ...walletMutationKeys.all, baseEntity }, ...additionalKeys];\n };\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * An error that is instantiated when someone attempts to perform an action that requires an active wallet connection.\n */\nexport class WalletNotConnectedError extends Error {}\n\n/**\n * An error that is instantiated when someone attempts to perform an action that requires a selected wallet account.\n * This is more of an edge case stemming from the fact that wallets don't technically require you to authorize any\n * accounts when connecting a wallet.\n */\nexport class WalletNoAccountSelectedError extends Error {}\n\n/**\n * An error that is instantiated when someone attempts to perform an action that isn't supported by a wallet.\n */\nexport class WalletFeatureNotSupportedError extends Error {}\n\n/**\n * An error that is instantiated when a wallet account can't be found for a specific wallet.\n */\nexport class WalletAccountNotFoundError extends Error {}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { useContext } from 'react';\n\nimport { IotaClientContext } from '../components/IotaClientProvider.js';\n\nexport function useIotaClientContext() {\n const iotaClient = useContext(IotaClientContext);\n\n if (!iotaClient) {\n throw new Error(\n 'Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider',\n );\n }\n\n return iotaClient;\n}\n\nexport function useIotaClient(): IotaClient {\n return useIotaClientContext().client;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getNetwork, isIotaClient, Network, IotaClient } from '@iota/iota-sdk/client';\nimport type { IotaClientOptions } from '@iota/iota-sdk/client';\nimport { createContext, useMemo, useState } from 'react';\n\nimport type { NetworkConfig } from '../hooks/networkConfig.js';\n\ntype NetworkConfigs<T extends NetworkConfig | IotaClient = NetworkConfig | IotaClient> = Record<\n string,\n T\n>;\n\nexport interface IotaClientProviderContext {\n client: IotaClient;\n networks: NetworkConfigs;\n network: string;\n config: NetworkConfig | null;\n selectNetwork: (network: string) => void;\n}\n\nexport const IotaClientContext = createContext<IotaClientProviderContext | null>(null);\n\nexport type IotaClientProviderProps<T extends NetworkConfigs> = {\n createClient?: (name: keyof T, config: T[keyof T]) => IotaClient;\n children: React.ReactNode;\n networks?: T;\n onNetworkChange?: (network: keyof T & string) => void;\n} & (\n | {\n defaultNetwork?: keyof T & string;\n network?: never;\n }\n | {\n defaultNetwork?: never;\n network?: keyof T & string;\n }\n);\n\nconst DEFAULT_NETWORKS = {\n localnet: { url: getNetwork(Network.Local).url },\n};\n\nconst DEFAULT_CREATE_CLIENT = function createClient(\n _name: string,\n config: NetworkConfig | IotaClient,\n) {\n if (isIotaClient(config)) {\n return config;\n }\n\n return new IotaClient(config);\n};\n\nexport function IotaClientProvider<T extends NetworkConfigs>(props: IotaClientProviderProps<T>) {\n const { onNetworkChange, network, children } = props;\n const networks = (props.networks ?? DEFAULT_NETWORKS) as T;\n const createClient =\n (props.createClient as typeof DEFAULT_CREATE_CLIENT) ?? DEFAULT_CREATE_CLIENT;\n\n const [selectedNetwork, setSelectedNetwork] = useState<keyof T & string>(\n props.network ?? props.defaultNetwork ?? (Object.keys(networks)[0] as keyof T & string),\n );\n\n const currentNetwork = props.network ?? selectedNetwork;\n\n const client = useMemo(() => {\n return createClient(currentNetwork, networks[currentNetwork]);\n }, [createClient, currentNetwork, networks]);\n\n const ctx = useMemo((): IotaClientProviderContext => {\n return {\n client,\n networks,\n network: currentNetwork,\n config:\n networks[currentNetwork] instanceof IotaClient\n ? null\n : (networks[currentNetwork] as IotaClientOptions),\n selectNetwork: (newNetwork) => {\n if (currentNetwork === newNetwork) {\n return;\n }\n\n if (!network && newNetwork !== selectedNetwork) {\n setSelectedNetwork(newNetwork);\n }\n\n onNetworkChange?.(newNetwork);\n },\n };\n }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);\n\n return <IotaClientContext.Provider value={ctx}>{children}</IotaClientContext.Provider>;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useContext } from 'react';\nimport { useStore } from 'zustand';\n\nimport { WalletContext } from '../../contexts/walletContext.js';\nimport type { StoreState } from '../../walletStore.js';\n\nexport function useWalletStore<T>(selector: (state: StoreState) => T): T {\n const store = useContext(WalletContext);\n if (!store) {\n throw new Error(\n 'Could not find WalletContext. Ensure that you have set up the WalletProvider.',\n );\n }\n return useStore(store, selector);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { createContext } from 'react';\n\nimport type { WalletStore } from '../walletStore.js';\n\nexport const WalletContext = createContext<WalletStore | null>(null);\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { WalletAccount } from '@iota/wallet-standard';\n\nimport { useWalletStore } from './useWalletStore.js';\n\n/**\n * Retrieves the wallet account that is currently selected, if one exists.\n */\nexport function useCurrentAccount(): WalletAccount | null {\n return useWalletStore((state) => state.currentAccount);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useWalletStore } from './useWalletStore.js';\n\n/**\n * Retrieves the wallet that is currently connected to the dApp, if one exists.\n */\nexport function useCurrentWallet() {\n const currentWallet = useWalletStore((state) => state.currentWallet);\n const connectionStatus = useWalletStore((state) => state.connectionStatus);\n const supportedIntents = useWalletStore((state) => state.supportedIntents);\n\n switch (connectionStatus) {\n case 'connecting':\n return {\n connectionStatus,\n currentWallet: null,\n isDisconnected: false,\n isConnecting: true,\n isConnected: false,\n supportedIntents: [],\n } as const;\n case 'disconnected':\n return {\n connectionStatus,\n currentWallet: null,\n isDisconnected: true,\n isConnecting: false,\n isConnected: false,\n supportedIntents: [],\n } as const;\n case 'connected': {\n return {\n connectionStatus,\n currentWallet: currentWallet!,\n isDisconnected: false,\n isConnecting: false,\n isConnected: true,\n supportedIntents,\n } as const;\n }\n }\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { toB64 } from '@iota/iota-sdk/utils';\nimport type { IotaReportTransactionEffectsInput } from '@iota/wallet-standard';\nimport type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { walletMutationKeys } from '../../constants/walletMutationKeys.js';\nimport type { WalletFeatureNotSupportedError } from '../../errors/walletErrors.js';\nimport {\n WalletNoAccountSelectedError,\n WalletNotConnectedError,\n} from '../../errors/walletErrors.js';\nimport type { PartialBy } from '../../types/utilityTypes.js';\nimport { useCurrentAccount } from './useCurrentAccount.js';\nimport { useCurrentWallet } from './useCurrentWallet.js';\n\ntype UseReportTransactionEffectsArgs = Omit<\n PartialBy<IotaReportTransactionEffectsInput, 'account' | 'chain'>,\n 'effects'\n> & {\n effects: string | number[];\n};\n\ntype UseReportTransactionEffectsError =\n | WalletFeatureNotSupportedError\n | WalletNoAccountSelectedError\n | WalletNotConnectedError\n | Error;\n\ntype UseReportTransactionEffectsMutationOptions = Omit<\n UseMutationOptions<\n void,\n UseReportTransactionEffectsError,\n UseReportTransactionEffectsArgs,\n unknown\n >,\n 'mutationFn'\n>;\n\n/**\n * Mutation hook for prompting the user to sign a message.\n */\nexport function useReportTransactionEffects({\n mutationKey,\n ...mutationOptions\n}: UseReportTransactionEffectsMutationOptions = {}): UseMutationResult<\n void,\n UseReportTransactionEffectsError,\n UseReportTransactionEffectsArgs\n> {\n const { currentWallet } = useCurrentWallet();\n const currentAccount = useCurrentAccount();\n\n return useMutation({\n mutationKey: walletMutationKeys.reportTransactionEffects(mutationKey),\n mutationFn: async ({\n effects,\n chain = currentWallet?.chains[0],\n account = currentAccount,\n }) => {\n if (!currentWallet) {\n throw new WalletNotConnectedError('No wallet is connected.');\n }\n\n if (!account) {\n throw new WalletNoAccountSelectedError(\n 'No wallet account is selected to report transaction effects for',\n );\n }\n\n const reportTransactionEffectsFeature =\n currentWallet.features['iota:reportTransactionEffects'];\n\n if (reportTransactionEffectsFeature) {\n return await reportTransactionEffectsFeature.reportTransactionEffects({\n effects: Array.isArray(effects) ? toB64(new Uint8Array(effects)) : effects,\n account,\n chain: chain ?? currentWallet?.chains[0],\n });\n }\n },\n ...mutationOptions,\n });\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,6BAAgC;AAGhC,IAAAA,sBAA4B;;;ACFrB,IAAM,qBAAqB;AAAA,EAC9B,KAAK,EAAE,WAAW,SAAS;AAAA,EAC3B,eAAe,kBAAkB,gBAAgB;AAAA,EACjD,mBAAmB,kBAAkB,oBAAoB;AAAA,EACzD,kBAAkB,kBAAkB,mBAAmB;AAAA,EACvD,qBAAqB,kBAAkB,uBAAuB;AAAA,EAC9D,iBAAiB,kBAAkB,kBAAkB;AAAA,EACrD,2BAA2B,kBAAkB,8BAA8B;AAAA,EAC3E,eAAe,kBAAkB,gBAA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MACJ;AAAA,IACJ;AAAA,IACA,GAAG;AAAA,EACP,CAAC;AACL;",
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction } from '@iota/iota-sdk/transactions';\nimport { signTransaction } from '@iota/wallet-standard';\nimport type { SignedTransaction, IotaSignTransactionInput } from '@iota/wallet-standard';\nimport type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { walletMutationKeys } from '../../constants/walletMutationKeys.js';\nimport {\n WalletFeatureNotSupportedError,\n WalletNoAccountSelectedError,\n WalletNotConnectedError,\n} from '../../errors/walletErrors.js';\nimport type { PartialBy } from '../../types/utilityTypes.js';\nimport { useIotaClient } from '../useIotaClient.js';\nimport { useCurrentAccount } from './useCurrentAccount.js';\nimport { useCurrentWallet } from './useCurrentWallet.js';\nimport { useReportTransactionEffects } from './useReportTransactionEffects.js';\n\ntype UseSignTransactionArgs = PartialBy<\n Omit<IotaSignTransactionInput, 'transaction'>,\n 'account' | 'chain'\n> & {\n transaction: Transaction | string;\n};\n\ninterface UseSignTransactionResult extends SignedTransaction {\n reportTransactionEffects: (effects: string) => void;\n}\n\ntype UseSignTransactionError =\n | WalletFeatureNotSupportedError\n | WalletNoAccountSelectedError\n | WalletNotConnectedError\n | Error;\n\ntype UseSignTransactionMutationOptions = Omit<\n UseMutationOptions<\n UseSignTransactionResult,\n UseSignTransactionError,\n UseSignTransactionArgs,\n unknown\n >,\n 'mutationFn'\n>;\n\n/**\n * Mutation hook for prompting the user to sign a transaction.\n */\nexport function useSignTransaction({\n mutationKey,\n ...mutationOptions\n}: UseSignTransactionMutationOptions = {}): UseMutationResult<\n UseSignTransactionResult,\n UseSignTransactionError,\n UseSignTransactionArgs\n> {\n const { currentWallet } = useCurrentWallet();\n const currentAccount = useCurrentAccount();\n const client = useIotaClient();\n\n const { mutate: reportTransactionEffects } = useReportTransactionEffects();\n\n return useMutation({\n mutationKey: walletMutationKeys.signTransaction(mutationKey),\n mutationFn: async ({ transaction, ...signTransactionArgs }) => {\n if (!currentWallet) {\n throw new WalletNotConnectedError('No wallet is connected.');\n }\n\n const signerAccount = signTransactionArgs.account ?? currentAccount;\n if (!signerAccount) {\n throw new WalletNoAccountSelectedError(\n 'No wallet account is selected to sign the transaction with.',\n );\n }\n\n if (!currentWallet.features['iota:signTransaction']) {\n throw new WalletFeatureNotSupportedError(\n \"This wallet doesn't support the `signTransaction` feature.\",\n );\n }\n\n const { bytes, signature } = await signTransaction(currentWallet, {\n ...signTransactionArgs,\n transaction: {\n toJSON: async () => {\n return typeof transaction === 'string'\n ? transaction\n : await transaction.toJSON({\n supportedIntents: [],\n client,\n });\n },\n },\n account: signerAccount,\n chain: signTransactionArgs.chain ?? signerAccount.chains[0],\n });\n\n return {\n bytes,\n signature,\n reportTransactionEffects: (effects) => {\n reportTransactionEffects({\n effects,\n account: signerAccount,\n chain: signTransactionArgs.chain ?? signerAccount.chains[0],\n });\n },\n };\n },\n ...mutationOptions,\n });\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { MutationKey } from '@tanstack/react-query';\n\nexport const walletMutationKeys = {\n all: { baseScope: 'wallet' },\n connectWallet: formMutationKeyFn('connect-wallet'),\n autoconnectWallet: formMutationKeyFn('autoconnect-wallet'),\n disconnectWallet: formMutationKeyFn('disconnect-wallet'),\n signPersonalMessage: formMutationKeyFn('sign-personal-message'),\n signTransaction: formMutationKeyFn('sign-transaction'),\n signAndExecuteTransaction: formMutationKeyFn('sign-and-execute-transaction'),\n switchAccount: formMutationKeyFn('switch-account'),\n reportTransactionEffects: formMutationKeyFn('report-transaction-effects'),\n};\n\nfunction formMutationKeyFn(baseEntity: string) {\n return function mutationKeyFn(additionalKeys: MutationKey = []) {\n return [{ ...walletMutationKeys.all, baseEntity }, ...additionalKeys];\n };\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * An error that is instantiated when someone attempts to perform an action that requires an active wallet connection.\n */\nexport class WalletNotConnectedError extends Error {}\n\n/**\n * An error that is instantiated when someone attempts to perform an action that requires a selected wallet account.\n * This is more of an edge case stemming from the fact that wallets don't technically require you to authorize any\n * accounts when connecting a wallet.\n */\nexport class WalletNoAccountSelectedError extends Error {}\n\n/**\n * An error that is instantiated when someone attempts to perform an action that isn't supported by a wallet.\n */\nexport class WalletFeatureNotSupportedError extends Error {}\n\n/**\n * An error that is instantiated when a wallet account can't be found for a specific wallet.\n */\nexport class WalletAccountNotFoundError extends Error {}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { useContext } from 'react';\n\nimport { IotaClientContext } from '../components/IotaClientProvider.js';\n\nexport function useIotaClientContext() {\n const iotaClient = useContext(IotaClientContext);\n\n if (!iotaClient) {\n throw new Error(\n 'Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider',\n );\n }\n\n return iotaClient;\n}\n\nexport function useIotaClient(): IotaClient {\n return useIotaClientContext().client;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getNetwork, isIotaClient, Network, IotaClient } from '@iota/iota-sdk/client';\nimport type { IotaClientOptions } from '@iota/iota-sdk/client';\nimport { createContext, useMemo, useState } from 'react';\n\nimport type { NetworkConfig } from '../hooks/networkConfig.js';\n\ntype NetworkConfigs<T extends NetworkConfig | IotaClient = NetworkConfig | IotaClient> = Record<\n string,\n T\n>;\n\nexport interface IotaClientProviderContext {\n client: IotaClient;\n networks: NetworkConfigs;\n network: string;\n config: NetworkConfig | null;\n selectNetwork: (network: string) => void;\n}\n\nexport const IotaClientContext = createContext<IotaClientProviderContext | null>(null);\n\nexport type IotaClientProviderProps<T extends NetworkConfigs> = {\n createClient?: (name: keyof T, config: T[keyof T]) => IotaClient;\n children: React.ReactNode;\n networks?: T;\n onNetworkChange?: (network: keyof T & string) => void;\n} & (\n | {\n defaultNetwork?: keyof T & string;\n network?: never;\n }\n | {\n defaultNetwork?: never;\n network?: keyof T & string;\n }\n);\n\nconst DEFAULT_NETWORKS = {\n localnet: { url: getNetwork(Network.Localnet).url },\n};\n\nconst DEFAULT_CREATE_CLIENT = function createClient(\n _name: string,\n config: NetworkConfig | IotaClient,\n) {\n if (isIotaClient(config)) {\n return config;\n }\n\n return new IotaClient(config);\n};\n\nexport function IotaClientProvider<T extends NetworkConfigs>(props: IotaClientProviderProps<T>) {\n const { onNetworkChange, network, children } = props;\n const networks = (props.networks ?? DEFAULT_NETWORKS) as T;\n const createClient =\n (props.createClient as typeof DEFAULT_CREATE_CLIENT) ?? DEFAULT_CREATE_CLIENT;\n\n const [selectedNetwork, setSelectedNetwork] = useState<keyof T & string>(\n props.network ?? props.defaultNetwork ?? (Object.keys(networks)[0] as keyof T & string),\n );\n\n const currentNetwork = props.network ?? selectedNetwork;\n\n const client = useMemo(() => {\n return createClient(currentNetwork, networks[currentNetwork]);\n }, [createClient, currentNetwork, networks]);\n\n const ctx = useMemo((): IotaClientProviderContext => {\n return {\n client,\n networks,\n network: currentNetwork,\n config:\n networks[currentNetwork] instanceof IotaClient\n ? null\n : (networks[currentNetwork] as IotaClientOptions),\n selectNetwork: (newNetwork) => {\n if (currentNetwork === newNetwork) {\n return;\n }\n\n if (!network && newNetwork !== selectedNetwork) {\n setSelectedNetwork(newNetwork);\n }\n\n onNetworkChange?.(newNetwork);\n },\n };\n }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);\n\n return <IotaClientContext.Provider value={ctx}>{children}</IotaClientContext.Provider>;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useContext } from 'react';\nimport { useStore } from 'zustand';\n\nimport { WalletContext } from '../../contexts/walletContext.js';\nimport type { StoreState } from '../../walletStore.js';\n\nexport function useWalletStore<T>(selector: (state: StoreState) => T): T {\n const store = useContext(WalletContext);\n if (!store) {\n throw new Error(\n 'Could not find WalletContext. Ensure that you have set up the WalletProvider.',\n );\n }\n return useStore(store, selector);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { createContext } from 'react';\n\nimport type { WalletStore } from '../walletStore.js';\n\nexport const WalletContext = createContext<WalletStore | null>(null);\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { WalletAccount } from '@iota/wallet-standard';\n\nimport { useWalletStore } from './useWalletStore.js';\n\n/**\n * Retrieves the wallet account that is currently selected, if one exists.\n */\nexport function useCurrentAccount(): WalletAccount | null {\n return useWalletStore((state) => state.currentAccount);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useWalletStore } from './useWalletStore.js';\n\n/**\n * Retrieves the wallet that is currently connected to the dApp, if one exists.\n */\nexport function useCurrentWallet() {\n const currentWallet = useWalletStore((state) => state.currentWallet);\n const connectionStatus = useWalletStore((state) => state.connectionStatus);\n const supportedIntents = useWalletStore((state) => state.supportedIntents);\n\n switch (connectionStatus) {\n case 'connecting':\n return {\n connectionStatus,\n currentWallet: null,\n isDisconnected: false,\n isConnecting: true,\n isConnected: false,\n supportedIntents: [],\n } as const;\n case 'disconnected':\n return {\n connectionStatus,\n currentWallet: null,\n isDisconnected: true,\n isConnecting: false,\n isConnected: false,\n supportedIntents: [],\n } as const;\n case 'connected': {\n return {\n connectionStatus,\n currentWallet: currentWallet!,\n isDisconnected: false,\n isConnecting: false,\n isConnected: true,\n supportedIntents,\n } as const;\n }\n }\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { toB64 } from '@iota/iota-sdk/utils';\nimport type { IotaReportTransactionEffectsInput } from '@iota/wallet-standard';\nimport type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { walletMutationKeys } from '../../constants/walletMutationKeys.js';\nimport type { WalletFeatureNotSupportedError } from '../../errors/walletErrors.js';\nimport {\n WalletNoAccountSelectedError,\n WalletNotConnectedError,\n} from '../../errors/walletErrors.js';\nimport type { PartialBy } from '../../types/utilityTypes.js';\nimport { useCurrentAccount } from './useCurrentAccount.js';\nimport { useCurrentWallet } from './useCurrentWallet.js';\n\ntype UseReportTransactionEffectsArgs = Omit<\n PartialBy<IotaReportTransactionEffectsInput, 'account' | 'chain'>,\n 'effects'\n> & {\n effects: string | number[];\n};\n\ntype UseReportTransactionEffectsError =\n | WalletFeatureNotSupportedError\n | WalletNoAccountSelectedError\n | WalletNotConnectedError\n | Error;\n\ntype UseReportTransactionEffectsMutationOptions = Omit<\n UseMutationOptions<\n void,\n UseReportTransactionEffectsError,\n UseReportTransactionEffectsArgs,\n unknown\n >,\n 'mutationFn'\n>;\n\n/**\n * Mutation hook for prompting the user to sign a message.\n */\nexport function useReportTransactionEffects({\n mutationKey,\n ...mutationOptions\n}: UseReportTransactionEffectsMutationOptions = {}): UseMutationResult<\n void,\n UseReportTransactionEffectsError,\n UseReportTransactionEffectsArgs\n> {\n const { currentWallet } = useCurrentWallet();\n const currentAccount = useCurrentAccount();\n\n return useMutation({\n mutationKey: walletMutationKeys.reportTransactionEffects(mutationKey),\n mutationFn: async ({\n effects,\n chain = currentWallet?.chains[0],\n account = currentAccount,\n }) => {\n if (!currentWallet) {\n throw new WalletNotConnectedError('No wallet is connected.');\n }\n\n if (!account) {\n throw new WalletNoAccountSelectedError(\n 'No wallet account is selected to report transaction effects for',\n );\n }\n\n const reportTransactionEffectsFeature =\n currentWallet.features['iota:reportTransactionEffects'];\n\n if (reportTransactionEffectsFeature) {\n return await reportTransactionEffectsFeature.reportTransactionEffects({\n effects: Array.isArray(effects) ? toB64(new Uint8Array(effects)) : effects,\n account,\n chain: chain ?? currentWallet?.chains[0],\n });\n }\n },\n ...mutationOptions,\n });\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,6BAAgC;AAGhC,IAAAA,sBAA4B;;;ACFrB,IAAM,qBAAqB;AAAA,EAC9B,KAAK,EAAE,WAAW,SAAS;AAAA,EAC3B,eAAe,kBAAkB,gBAAgB;AAAA,EACjD,mBAAmB,kBAAkB,oBAAoB;AAAA,EACzD,kBAAkB,kBAAkB,mBAAmB;AAAA,EACvD,qBAAqB,kBAAkB,uBAAuB;AAAA,EAC9D,iBAAiB,kBAAkB,kBAAkB;AAAA,EACrD,2BAA2B,kBAAkB,8BAA8B;AAAA,EAC3E,eAAe,kBAAkB,gBAAgB;AAAA,EACjD,0BAA0B,kBAAkB,4BAA4B;AAC5E;AAEA,SAAS,kBAAkB,YAAoB;AAC3C,SAAO,SAAS,cAAc,iBAA8B,CAAC,GAAG;AAC5D,WAAO,CAAC,EAAE,GAAG,mBAAmB,KAAK,WAAW,GAAG,GAAG,cAAc;AAAA,EACxE;AACJ;;;ACfO,IAAM,0BAAN,cAAsC,MAAM;AAAC;AAO7C,IAAM,+BAAN,cAA2C,MAAM;AAAC;AAKlD,IAAM,iCAAN,cAA6C,MAAM;AAAC;;;ACd3D,IAAAC,gBAA2B;;;ACD3B,oBAA8D;AAE9D,mBAAiD;AAyFtC;AAxEJ,IAAM,wBAAoB,4BAAgD,IAAI;AAkBrF,IAAM,mBAAmB;AAAA,EACrB,UAAU,EAAE,SAAK,0BAAW,sBAAQ,QA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gBAAgB,oBAAoB,WAAW;AACrD,UAAI,CAAC,eAAe;AAChB,cAAM,IAAI;AAAA,UACN;AAAA,QACJ;AAAA,MACJ;AAEA,UAAI,CAAC,cAAc,SAAS,sBAAsB,GAAG;AACjD,cAAM,IAAI;AAAA,UACN;AAAA,QACJ;AAAA,MACJ;AAEA,YAAM,EAAE,OAAO,UAAU,IAAI,UAAM,wCAAgB,eAAe;AAAA,QAC9D,GAAG;AAAA,QACH,aAAa;AAAA,UACT,QAAQ,YAAY;AAChB,mBAAO,OAAO,gBAAgB,WACxB,cACA,MAAM,YAAY,OAAO;AAAA,cACrB,kBAAkB,CAAC;AAAA,cACnB;AAAA,YACJ,CAAC;AAAA,UACX;AAAA,QACJ;AAAA,QACA,SAAS;AAAA,QACT,OAAO,oBAAoB,SAAS,cAAc,OAAO,CAAC;AAAA,MAC9D,CAAC;AAED,aAAO;AAAA,QACH;AAAA,QACA;AAAA,QACA,0BAA0B,CAAC,YAAY;AACnC,mCAAyB;AAAA,YACrB;AAAA,YACA,SAAS;AAAA,YACT,OAAO,oBAAoB,SAAS,cAAc,OAAO,CAAC;AAAA,UAC9D,CAAC;AAAA,QACL;AAAA,MACJ;AAAA,IACJ;AAAA,IACA,GAAG;AAAA,EACP,CAAC;AACL;",
6
6
  "names": ["import_react_query", "import_react", "import_react", "import_react"]
7
7
  }
@@ -44,7 +44,7 @@ var import_react = require("react");
44
44
  var import_jsx_runtime = require("react/jsx-runtime");
45
45
  var IotaClientContext = (0, import_react.createContext)(null);
46
46
  var DEFAULT_NETWORKS = {
47
- localnet: { url: (0, import_client.getNetwork)(import_client.Network.Local).url }
47
+ localnet: { url: (0, import_client.getNetwork)(import_client.Network.Localnet).url }
48
48
  };
49
49
 
50
50
  // src/hooks/useIotaClient.ts
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/hooks/wallet/useUnsafeBurnerWallet.ts", "../../../../src/hooks/useIotaClient.ts", "../../../../src/components/IotaClientProvider.tsx"],
4
- "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { Ed25519Keypair } from '@iota/iota-sdk/keypairs/ed25519';\nimport { Transaction } from '@iota/iota-sdk/transactions';\nimport { toB64 } from '@iota/iota-sdk/utils';\nimport type {\n StandardConnectFeature,\n StandardConnectMethod,\n StandardEventsFeature,\n StandardEventsOnMethod,\n IotaFeatures,\n IotaSignAndExecuteTransactionMethod,\n IotaSignPersonalMessageMethod,\n IotaSignTransactionMethod,\n Wallet,\n} from '@iota/wallet-standard';\nimport { getWallets, ReadonlyWalletAccount, SUPPORTED_CHAINS } from '@iota/wallet-standard';\nimport { useEffect } from 'react';\n\nimport { useIotaClient } from '../useIotaClient.js';\n\nconst WALLET_NAME = 'Unsafe Burner Wallet';\n\nexport function useUnsafeBurnerWallet(enabled: boolean) {\n const iotaClient = useIotaClient();\n\n useEffect(() => {\n if (!enabled) {\n return;\n }\n const unregister = registerUnsafeBurnerWallet(iotaClient);\n return unregister;\n }, [enabled, iotaClient]);\n}\n\nfunction registerUnsafeBurnerWallet(iotaClient: IotaClient) {\n const walletsApi = getWallets();\n const registeredWallets = walletsApi.get();\n\n if (registeredWallets.find((wallet) => wallet.name === WALLET_NAME)) {\n console.warn(\n 'registerUnsafeBurnerWallet: Unsafe Burner Wallet already registered, skipping duplicate registration.',\n );\n return;\n }\n\n console.warn(\n 'Your application is currently using the unsafe burner wallet. Make sure that this wallet is disabled in production.',\n );\n\n const keypair = new Ed25519Keypair();\n const account = new ReadonlyWalletAccount({\n address: keypair.getPublicKey().toIotaAddress(),\n publicKey: keypair.getPublicKey().toIotaBytes(),\n chains: ['iota:unknown'],\n features: ['iota:signTransaction', 'iota:signAndExecuteTransaction'],\n });\n\n class UnsafeBurnerWallet implements Wallet {\n get version() {\n return '1.0.0' as const;\n }\n\n get name() {\n return WALL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tpN3Hx3s2G+d79/MJf4qff0LnE72kfFEs4ITQvWLMab8C131dP9n9Je1Yx000Nz2jAf+UJwCBchc3NvGR1Qx71XXY2Ww1Jvx7YalzAPkX9rp5E5Z+pv+ja8bE43uN491b9dHO9Xx4lUxziLn21Nai/wXWM6t9vkvtrwAAAABJRU5ErkJggg==' as const;\n }\n\n // Return the IOTA chains that your wallet supports.\n get chains() {\n return SUPPORTED_CHAINS;\n }\n\n get accounts() {\n return [account];\n }\n\n get features(): StandardConnectFeature & StandardEventsFeature & IotaFeatures {\n return {\n 'standard:connect': {\n version: '1.0.0',\n connect: this.#connect,\n },\n 'standard:events': {\n version: '1.0.0',\n on: this.#on,\n },\n 'iota:signPersonalMessage': {\n version: '1.0.0',\n signPersonalMessage: this.#signPersonalMessage,\n },\n 'iota:signTransaction': {\n version: '2.0.0',\n signTransaction: this.#signTransaction,\n },\n 'iota:signAndExecuteTransaction': {\n version: '2.0.0',\n signAndExecuteTransaction: this.#signAndExecuteTransaction,\n },\n };\n }\n\n #on: StandardEventsOnMethod = () => {\n return () => {};\n };\n\n #connect: StandardConnectMethod = async () => {\n return { accounts: this.accounts };\n };\n\n #signPersonalMessage: IotaSignPersonalMessageMethod = async (messageInput) => {\n const { bytes, signature } = await keypair.signPersonalMessage(messageInput.message);\n return { bytes, signature };\n };\n\n #signTransaction: IotaSignTransactionMethod = async (transactionInput) => {\n const { bytes, signature } = await Transaction.from(\n await transactionInput.transaction.toJSON(),\n ).sign({\n client: iotaClient,\n signer: keypair,\n });\n\n transactionInput.signal?.throwIfAborted();\n\n return {\n bytes,\n signature: signature,\n };\n };\n\n #signAndExecuteTransaction: IotaSignAndExecuteTransactionMethod = async (\n transactionInput,\n ) => {\n const { bytes, signature } = await Transaction.from(\n await transactionInput.transaction.toJSON(),\n ).sign({\n client: iotaClient,\n signer: keypair,\n });\n\n transactionInput.signal?.throwIfAborted();\n\n const { rawEffects, digest } = await iotaClient.executeTransactionBlock({\n signature,\n transactionBlock: bytes,\n options: {\n showRawEffects: true,\n },\n });\n\n return {\n bytes,\n signature,\n digest,\n effects: toB64(new Uint8Array(rawEffects!)),\n };\n };\n }\n\n return walletsApi.register(new UnsafeBurnerWallet());\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { useContext } from 'react';\n\nimport { IotaClientContext } from '../components/IotaClientProvider.js';\n\nexport function useIotaClientContext() {\n const iotaClient = useContext(IotaClientContext);\n\n if (!iotaClient) {\n throw new Error(\n 'Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider',\n );\n }\n\n return iotaClient;\n}\n\nexport function useIotaClient(): IotaClient {\n return useIotaClientContext().client;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getNetwork, isIotaClient, Network, IotaClient } from '@iota/iota-sdk/client';\nimport type { IotaClientOptions } from '@iota/iota-sdk/client';\nimport { createContext, useMemo, useState } from 'react';\n\nimport type { NetworkConfig } from '../hooks/networkConfig.js';\n\ntype NetworkConfigs<T extends NetworkConfig | IotaClient = NetworkConfig | IotaClient> = Record<\n string,\n T\n>;\n\nexport interface IotaClientProviderContext {\n client: IotaClient;\n networks: NetworkConfigs;\n network: string;\n config: NetworkConfig | null;\n selectNetwork: (network: string) => void;\n}\n\nexport const IotaClientContext = createContext<IotaClientProviderContext | null>(null);\n\nexport type IotaClientProviderProps<T extends NetworkConfigs> = {\n createClient?: (name: keyof T, config: T[keyof T]) => IotaClient;\n children: React.ReactNode;\n networks?: T;\n onNetworkChange?: (network: keyof T & string) => void;\n} & (\n | {\n defaultNetwork?: keyof T & string;\n network?: never;\n }\n | {\n defaultNetwork?: never;\n network?: keyof T & string;\n }\n);\n\nconst DEFAULT_NETWORKS = {\n localnet: { url: getNetwork(Network.Local).url },\n};\n\nconst DEFAULT_CREATE_CLIENT = function createClient(\n _name: string,\n config: NetworkConfig | IotaClient,\n) {\n if (isIotaClient(config)) {\n return config;\n }\n\n return new IotaClient(config);\n};\n\nexport function IotaClientProvider<T extends NetworkConfigs>(props: IotaClientProviderProps<T>) {\n const { onNetworkChange, network, children } = props;\n const networks = (props.networks ?? DEFAULT_NETWORKS) as T;\n const createClient =\n (props.createClient as typeof DEFAULT_CREATE_CLIENT) ?? DEFAULT_CREATE_CLIENT;\n\n const [selectedNetwork, setSelectedNetwork] = useState<keyof T & string>(\n props.network ?? props.defaultNetwork ?? (Object.keys(networks)[0] as keyof T & string),\n );\n\n const currentNetwork = props.network ?? selectedNetwork;\n\n const client = useMemo(() => {\n return createClient(currentNetwork, networks[currentNetwork]);\n }, [createClient, currentNetwork, networks]);\n\n const ctx = useMemo((): IotaClientProviderContext => {\n return {\n client,\n networks,\n network: currentNetwork,\n config:\n networks[currentNetwork] instanceof IotaClient\n ? null\n : (networks[currentNetwork] as IotaClientOptions),\n selectNetwork: (newNetwork) => {\n if (currentNetwork === newNetwork) {\n return;\n }\n\n if (!network && newNetwork !== selectedNetwork) {\n setSelectedNetwork(newNetwork);\n }\n\n onNetworkChange?.(newNetwork);\n },\n };\n }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);\n\n return <IotaClientContext.Provider value={ctx}>{children}</IotaClientContext.Provider>;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,qBAA+B;AAC/B,0BAA4B;AAC5B,mBAAsB;AAYtB,6BAAoE;AACpE,IAAAA,gBAA0B;;;ACf1B,IAAAC,gBAA2B;;;ACD3B,oBAA8D;AAE9D,mBAAiD;AAyFtC;AAxEJ,IAAM,wBAAoB,4BAAgD,IAAI;AAkBrF,IAAM,mBAAmB;AAAA,EACrB,UAAU,EAAE,SAAK,0BAAW,sBAAQ,KAAK,EAAE,IAAI;AACnD;;;ADlCO,SAAS,uBAAuB;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S;AAAA,UACT,qBAAqB,mBAAK;AAAA,QAC9B;AAAA,QACA,wBAAwB;AAAA,UACpB,SAAS;AAAA,UACT,iBAAiB,mBAAK;AAAA,QAC1B;AAAA,QACA,kCAAkC;AAAA,UAC9B,SAAS;AAAA,UACT,2BAA2B,mBAAK;AAAA,QACpC;AAAA,MACJ;AAAA,IACJ;AAAA,EA0DJ;AAxDI;AAIA;AAIA;AAKA;AAgBA;AA6BJ,SAAO,WAAW,SAAS,IAAI,mBAAmB,CAAC;AACvD;",
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { Ed25519Keypair } from '@iota/iota-sdk/keypairs/ed25519';\nimport { Transaction } from '@iota/iota-sdk/transactions';\nimport { toB64 } from '@iota/iota-sdk/utils';\nimport type {\n StandardConnectFeature,\n StandardConnectMethod,\n StandardEventsFeature,\n StandardEventsOnMethod,\n IotaFeatures,\n IotaSignAndExecuteTransactionMethod,\n IotaSignPersonalMessageMethod,\n IotaSignTransactionMethod,\n Wallet,\n} from '@iota/wallet-standard';\nimport { getWallets, ReadonlyWalletAccount, SUPPORTED_CHAINS } from '@iota/wallet-standard';\nimport { useEffect } from 'react';\n\nimport { useIotaClient } from '../useIotaClient.js';\n\nconst WALLET_NAME = 'Unsafe Burner Wallet';\n\nexport function useUnsafeBurnerWallet(enabled: boolean) {\n const iotaClient = useIotaClient();\n\n useEffect(() => {\n if (!enabled) {\n return;\n }\n const unregister = registerUnsafeBurnerWallet(iotaClient);\n return unregister;\n }, [enabled, iotaClient]);\n}\n\nfunction registerUnsafeBurnerWallet(iotaClient: IotaClient) {\n const walletsApi = getWallets();\n const registeredWallets = walletsApi.get();\n\n if (registeredWallets.find((wallet) => wallet.name === WALLET_NAME)) {\n console.warn(\n 'registerUnsafeBurnerWallet: Unsafe Burner Wallet already registered, skipping duplicate registration.',\n );\n return;\n }\n\n console.warn(\n 'Your application is currently using the unsafe burner wallet. Make sure that this wallet is disabled in production.',\n );\n\n const keypair = new Ed25519Keypair();\n const account = new ReadonlyWalletAccount({\n address: keypair.getPublicKey().toIotaAddress(),\n publicKey: keypair.getPublicKey().toIotaBytes(),\n chains: ['iota:unknown'],\n features: ['iota:signTransaction', 'iota:signAndExecuteTransaction'],\n });\n\n class UnsafeBurnerWallet implements Wallet {\n get version() {\n return '1.0.0' as const;\n }\n\n get name() {\n return WALLET_NAME;\n }\n\n get icon() {\n return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAJrElEQVR42tWbe2xT1x3H7UxAyD3XrdrSbGXlUbKWsq5rWdVuVOMRSEqSOmnVRZMmJqZNYv1nf3R/jWmVmVrtRRM/YwPd1nVTNcrE3pQCoikrIRAC4VVNY0hlD9ZOo1uCfe3ra9979v0dcy3s5Pper76Oh/STE+495/4+5/c85zqe2f7HAx5vKsS+monJj/CdHi/f4/HWW4f6AwdblmXjTM0NyS+movKtw9v+j6C5gKhyTMTTpA2x15Qwy+Pz75motOGdgKep8WF5ATgVZIt5NeO2wMqD0hfVGNPh3oYaYflsjG0l63PeyLCDnqbsLpZIhaRNFI+Ox+Le5KB0RybK8gDmJOkI07U4i/FhT1NDQl8Me5rUIfaDfELOJ0NsFa/SJQHm1WLsHcDqRWiy9BCL8s0N5t6UWWFVvxplejYm60hC91cNjPtzCTZsAptCVoeLP8PDDQJNCSodap6H+LtE8ZcdkvVkkD38vwDn4/Jvy4EhBhZSvRaUHiTXn31gJJxkUPoClBKKFizM+inhVA2cYIdM4HJouPvoe9s9H+KzDhyGK6KkmIqitBhww2C11rjQL2L4kgUwFxk8yPyzauUA3Pk/353XnA6zKbKCaQ2UlMvJF6W5uF5F8yHfZWZpC9HRmBziaEpm1bpY9XvhxuWJRldC7Mt03WlZwpjnkZUNa2DMG2EaPj9MGd2l2mofd0hQ7ZSopsXckHxVCUp32fXGdD0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GP92jpCPQEbrW7EW5MbZxAz/fN9lg0IbQaaxrQ83/VoKPb/HqJx67Hw+43CDQBPsX0gm6ufXNvH4vP9rZapzx7+Nn+oxZAjfo2caZ3n350c5W6FSEdQ86sNarj3c/jRV+H42AXsdGRBfPPIlnb/mUtxzWXfALn/PmRze2Gud6E/xsXwYtnlsWN8Tc5/oyxjn/jvyJrlY82xLUfWuPr/TqxzuXQZkIP9M7CXiyuP4B4WmsTnNhzinjrD+WO9bRhmdZWLXe4EKRtV5tpN3Hx3s2G+d79/MJf4qff0LnE72kfFEs4ITQvWLMab8C131dP9n9Je1Yx000Nz2jAf+UJwCBchc3NvGR1Qx71XXY2Ww1Jvx7YalzAPkX9rp5E5Z+pv+ja8bE43uN491b9dHO9Xx4lUxziLn21Nai/wXWM6t9vkvtrwAAAABJRU5ErkJggg==' as const;\n }\n\n // Return the IOTA chains that your wallet supports.\n get chains() {\n return SUPPORTED_CHAINS;\n }\n\n get accounts() {\n return [account];\n }\n\n get features(): StandardConnectFeature & StandardEventsFeature & IotaFeatures {\n return {\n 'standard:connect': {\n version: '1.0.0',\n connect: this.#connect,\n },\n 'standard:events': {\n version: '1.0.0',\n on: this.#on,\n },\n 'iota:signPersonalMessage': {\n version: '1.0.0',\n signPersonalMessage: this.#signPersonalMessage,\n },\n 'iota:signTransaction': {\n version: '2.0.0',\n signTransaction: this.#signTransaction,\n },\n 'iota:signAndExecuteTransaction': {\n version: '2.0.0',\n signAndExecuteTransaction: this.#signAndExecuteTransaction,\n },\n };\n }\n\n #on: StandardEventsOnMethod = () => {\n return () => {};\n };\n\n #connect: StandardConnectMethod = async () => {\n return { accounts: this.accounts };\n };\n\n #signPersonalMessage: IotaSignPersonalMessageMethod = async (messageInput) => {\n const { bytes, signature } = await keypair.signPersonalMessage(messageInput.message);\n return { bytes, signature };\n };\n\n #signTransaction: IotaSignTransactionMethod = async (transactionInput) => {\n const { bytes, signature } = await Transaction.from(\n await transactionInput.transaction.toJSON(),\n ).sign({\n client: iotaClient,\n signer: keypair,\n });\n\n transactionInput.signal?.throwIfAborted();\n\n return {\n bytes,\n signature: signature,\n };\n };\n\n #signAndExecuteTransaction: IotaSignAndExecuteTransactionMethod = async (\n transactionInput,\n ) => {\n const { bytes, signature } = await Transaction.from(\n await transactionInput.transaction.toJSON(),\n ).sign({\n client: iotaClient,\n signer: keypair,\n });\n\n transactionInput.signal?.throwIfAborted();\n\n const { rawEffects, digest } = await iotaClient.executeTransactionBlock({\n signature,\n transactionBlock: bytes,\n options: {\n showRawEffects: true,\n },\n });\n\n return {\n bytes,\n signature,\n digest,\n effects: toB64(new Uint8Array(rawEffects!)),\n };\n };\n }\n\n return walletsApi.register(new UnsafeBurnerWallet());\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { useContext } from 'react';\n\nimport { IotaClientContext } from '../components/IotaClientProvider.js';\n\nexport function useIotaClientContext() {\n const iotaClient = useContext(IotaClientContext);\n\n if (!iotaClient) {\n throw new Error(\n 'Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider',\n );\n }\n\n return iotaClient;\n}\n\nexport function useIotaClient(): IotaClient {\n return useIotaClientContext().client;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getNetwork, isIotaClient, Network, IotaClient } from '@iota/iota-sdk/client';\nimport type { IotaClientOptions } from '@iota/iota-sdk/client';\nimport { createContext, useMemo, useState } from 'react';\n\nimport type { NetworkConfig } from '../hooks/networkConfig.js';\n\ntype NetworkConfigs<T extends NetworkConfig | IotaClient = NetworkConfig | IotaClient> = Record<\n string,\n T\n>;\n\nexport interface IotaClientProviderContext {\n client: IotaClient;\n networks: NetworkConfigs;\n network: string;\n config: NetworkConfig | null;\n selectNetwork: (network: string) => void;\n}\n\nexport const IotaClientContext = createContext<IotaClientProviderContext | null>(null);\n\nexport type IotaClientProviderProps<T extends NetworkConfigs> = {\n createClient?: (name: keyof T, config: T[keyof T]) => IotaClient;\n children: React.ReactNode;\n networks?: T;\n onNetworkChange?: (network: keyof T & string) => void;\n} & (\n | {\n defaultNetwork?: keyof T & string;\n network?: never;\n }\n | {\n defaultNetwork?: never;\n network?: keyof T & string;\n }\n);\n\nconst DEFAULT_NETWORKS = {\n localnet: { url: getNetwork(Network.Localnet).url },\n};\n\nconst DEFAULT_CREATE_CLIENT = function createClient(\n _name: string,\n config: NetworkConfig | IotaClient,\n) {\n if (isIotaClient(config)) {\n return config;\n }\n\n return new IotaClient(config);\n};\n\nexport function IotaClientProvider<T extends NetworkConfigs>(props: IotaClientProviderProps<T>) {\n const { onNetworkChange, network, children } = props;\n const networks = (props.networks ?? DEFAULT_NETWORKS) as T;\n const createClient =\n (props.createClient as typeof DEFAULT_CREATE_CLIENT) ?? DEFAULT_CREATE_CLIENT;\n\n const [selectedNetwork, setSelectedNetwork] = useState<keyof T & string>(\n props.network ?? props.defaultNetwork ?? (Object.keys(networks)[0] as keyof T & string),\n );\n\n const currentNetwork = props.network ?? selectedNetwork;\n\n const client = useMemo(() => {\n return createClient(currentNetwork, networks[currentNetwork]);\n }, [createClient, currentNetwork, networks]);\n\n const ctx = useMemo((): IotaClientProviderContext => {\n return {\n client,\n networks,\n network: currentNetwork,\n config:\n networks[currentNetwork] instanceof IotaClient\n ? null\n : (networks[currentNetwork] as IotaClientOptions),\n selectNetwork: (newNetwork) => {\n if (currentNetwork === newNetwork) {\n return;\n }\n\n if (!network && newNetwork !== selectedNetwork) {\n setSelectedNetwork(newNetwork);\n }\n\n onNetworkChange?.(newNetwork);\n },\n };\n }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);\n\n return <IotaClientContext.Provider value={ctx}>{children}</IotaClientContext.Provider>;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;A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IAGA,IAAI,SAAS;AACT,aAAO;AAAA,IACX;AAAA,IAEA,IAAI,WAAW;AACX,aAAO,CAAC,OAAO;AAAA,IACnB;AAAA,IAEA,IAAI,WAA0E;AAC1E,aAAO;AAAA,QACH,oBAAoB;AAAA,UAChB,SAAS;AAAA,UACT,SAAS,mBAAK;AAAA,QAClB;AAAA,QACA,mBAAmB;AAAA,UACf,SAAS;AAAA,UACT,IAAI,mBAAK;AAAA,QACb;AAAA,QACA,4BAA4B;AAAA,UACxB,SAAS;AAAA,UACT,qBAAqB,mBAAK;AAAA,QAC9B;AAAA,QACA,wBAAwB;AAAA,UACpB,SAAS;AAAA,UACT,iBAAiB,mBAAK;AAAA,QAC1B;AAAA,QACA,kCAAkC;AAAA,UAC9B,SAAS;AAAA,UACT,2BAA2B,mBAAK;AAAA,QACpC;AAAA,MACJ;AAAA,IACJ;AAAA,EA0DJ;AAxDI;AAIA;AAIA;AAKA;AAgBA;AA6BJ,SAAO,WAAW,SAAS,IAAI,mBAAmB,CAAC;AACvD;",
6
6
  "names": ["import_react", "import_react"]
7
7
  }
package/dist/cjs/index.js CHANGED
@@ -431,7 +431,7 @@ function GettingStarted() {
431
431
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: installButtonContainer, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button, { variant: "outline", asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
432
432
  "a",
433
433
  {
434
- href: "https://chrome.google.com/webstore/detail/iota-wallet/opcgpfmipidbgpenhmajoajpbobppdil",
434
+ href: "https://chrome.google.com/webstore/detail/iota-wallet/iidjkmdceolghepehaaddojmnjnkkija",
435
435
  target: "_blank",
436
436
  rel: "noreferrer",
437
437
  children: "Install Wallet Extension"
@@ -465,18 +465,24 @@ function useWallets() {
465
465
  // src/components/icons/IotaIcon.tsx
466
466
  var import_jsx_runtime12 = require("react/jsx-runtime");
467
467
  function IotaIcon(props) {
468
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg", { width: 28, height: 28, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
469
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("rect", { width: 28, height: 28, rx: 6, fill: "#6FBCF0" }),
470
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
471
- "path",
472
- {
473
- fillRule: "evenodd",
474
- clipRule: "evenodd",
475
- d: "M7.942 20.527A6.875 6.875 0 0 0 13.957 24c2.51 0 4.759-1.298 6.015-3.473a6.875 6.875 0 0 0 0-6.945l-5.29-9.164a.837.837 0 0 0-1.45 0l-5.29 9.164a6.875 6.875 0 0 0 0 6.945Zm4.524-11.75 1.128-1.953a.418.418 0 0 1 .725 0l4.34 7.516a5.365 5.365 0 0 1 .449 4.442 4.675 4.675 0 0 0-.223-.73c-.599-1.512-1.954-2.68-4.029-3.47-1.426-.54-2.336-1.336-2.706-2.364-.476-1.326.021-2.77.316-3.44Zm-1.923 3.332L9.255 14.34a5.373 5.373 0 0 0 0 5.43 5.373 5.373 0 0 0 4.702 2.714 5.38 5.38 0 0 0 3.472-1.247c.125-.314.51-1.462.034-2.646-.44-1.093-1.5-1.965-3.15-2.594-1.864-.707-3.076-1.811-3.6-3.28a4.601 4.601 0 0 1-.17-.608Z",
476
- fill: "#fff"
477
- }
478
- )
479
- ] });
468
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
469
+ "svg",
470
+ {
471
+ xmlns: "http://www.w3.org/2000/svg",
472
+ width: "28px",
473
+ height: "28px",
474
+ fill: "none",
475
+ viewBox: "0 0 24 24",
476
+ ...props,
477
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
478
+ "path",
479
+ {
480
+ fill: "#171d26",
481
+ d: "M18.27 2.259c0 .695-.568 1.259-1.268 1.259s-1.267-.564-1.267-1.259S16.302 1 17.002 1s1.268.564 1.268 1.259m1.425 17.785c0 .695-.568 1.259-1.268 1.259s-1.267-.564-1.267-1.26c0-.695.567-1.258 1.267-1.258s1.268.563 1.268 1.259m-2.33-13.379a1.06 1.06 0 0 0 1.063-1.056 1.06 1.06 0 0 0-1.063-1.057A1.06 1.06 0 0 0 16.3 5.61a1.06 1.06 0 0 0 1.064 1.056Zm3.891-.651a1.06 1.06 0 0 1-1.063 1.056 1.06 1.06 0 0 1-1.064-1.056 1.06 1.06 0 0 1 1.064-1.057 1.06 1.06 0 0 1 1.063 1.057m-4.253 3.329c.5 0 .905-.403.905-.9 0-.496-.405-.9-.905-.9s-.906.404-.906.9c0 .497.406.9.906.9m3.734-.52c0 .497-.405.9-.905.9a.903.903 0 0 1-.906-.9c0-.496.405-.9.906-.9.5 0 .905.404.905.9m1.357 1.777c.5 0 .906-.402.906-.899s-.405-.9-.906-.9c-.5 0-.905.403-.905.9s.405.9.905.9Zm-2.309.495a.79.79 0 0 1-.792.787.79.79 0 0 1-.791-.787c0-.434.354-.786.791-.786s.792.352.792.786m-3.62.404a.79.79 0 0 0 .792-.787.79.79 0 0 0-.792-.786.79.79 0 0 0-.791.786c0 .435.354.787.791.787m5.907.471a.79.79 0 0 1-.791.787.79.79 0 0 1-.792-.786.79.79 0 0 1 .792-.787.79.79 0 0 1 .791.787Zm-4.21 1.554c.375 0 .68-.302.68-.675a.677.677 0 0 0-.68-.675.68.68 0 0 0-.68.675c0 .373.304.675.68.675m2.968.178a.68.68 0 0 1-.68.676.677.677 0 0 1-.68-.676c0-.373.304-.675.68-.675.375 0 .68.302.68.675m-5.774-.582c.375 0 .68-.302.68-.675a.68.68 0 0 0-.68-.675.68.68 0 0 0-.68.675c0 .373.304.675.68.675m2.127.943c0 .31-.254.561-.566.561a.564.564 0 0 1-.566-.562c0-.31.253-.561.566-.561s.566.251.566.562m.407 2.114a.496.496 0 0 0 .498-.494.496.496 0 0 0-.498-.495.496.496 0 0 0-.498.495c0 .273.223.494.498.494m-.791-.09a.407.407 0 0 1-.408.405.407.407 0 0 1-.408-.405c0-.223.182-.405.408-.405s.408.181.408.405m-1.472-.765a.496.496 0 0 0 .498-.494.496.496 0 0 0-.498-.495.496.496 0 0 0-.498.495c0 .273.223.494.498.494m-.973-1.64c0 .31-.254.562-.566.562a.564.564 0 0 1-.566-.562c0-.31.253-.562.566-.562s.566.251.566.562m-.588-3.666a.564.564 0 0 0 .566-.562.564.564 0 0 0-.566-.562.564.564 0 0 0-.565.562c0 .31.253.562.565.562m.745-2.473a.496.496 0 0 1-.497.494.496.496 0 0 1-.498-.494c0-.273.223-.494.498-.494s.498.22.498.494Zm.047-1.123a.406.406 0 0 0 .407-.406.406.406 0 0 0-.407-.405.407.407 0 0 0-.408.405c0 .224.182.406.408.406m-.452-1.26a.496.496 0 0 1-.498.494.496.496 0 0 1-.498-.494c0-.273.223-.494.498-.494s.498.22.498.494m4.776 10.32a.564.564 0 0 0 .566-.561.564.564 0 0 0-.566-.562.564.564 0 0 0-.566.562c0 .31.253.562.566.562ZM12.883 4.439c0 .31-.254.562-.566.562a.564.564 0 0 1-.566-.562c0-.31.254-.562.566-.562s.566.251.566.562m-.18 2.945a.564.564 0 0 0 .566-.562.564.564 0 0 0-.566-.561.564.564 0 0 0-.566.561c0 .31.253.562.566.562m.045 1.597a.677.677 0 0 1-.68.676.68.68 0 0 1-.679-.676c0-.373.304-.675.68-.675.375 0 .68.302.68.675Zm-2.74.676a.79.79 0 0 0 .791-.786.79.79 0 0 0-.791-.787.79.79 0 0 0-.792.787c0 .434.354.786.792.786m-1.494-.36c0 .497-.405.9-.905.9a.903.903 0 0 1-.906-.9c0-.497.406-.9.906-.9s.905.403.905.9m-3.529 2.18a1.06 1.06 0 0 0 1.063-1.056 1.06 1.06 0 0 0-1.063-1.056A1.06 1.06 0 0 0 3.92 10.42a1.06 1.06 0 0 0 1.064 1.056Zm-1.45.9c0 .696-.568 1.26-1.268 1.26S1 13.073 1 12.377c0-.695.567-1.259 1.267-1.259s1.268.564 1.268 1.26Zm.386-3.531A1.06 1.06 0 0 0 4.985 7.79 1.06 1.06 0 0 0 3.92 6.733 1.06 1.06 0 0 0 2.858 7.79 1.06 1.06 0 0 0 3.92 8.846Zm3.53-2.181c0 .497-.405.9-.906.9a.903.903 0 0 1-.905-.9c0-.496.405-.9.905-.9s.906.404.906.9M6.162 5.182c.5 0 .905-.403.905-.9 0-.496-.405-.9-.905-.9s-.906.404-.906.9c0 .497.406.9.906.9m3.19-1.326a.79.79 0 0 1-.791.787.79.79 0 0 1-.792-.787c0-.434.354-.786.792-.786.437 0 .791.352.791.786m1.268.788c.375 0 .68-.303.68-.675a.677.677 0 0 0-.68-.676.68.68 0 0 0-.68.675c0 .373.304.676.68.676m1.063 1.708a.68.68 0 0 1-.68.675.677.677 0 0 1-.68-.675c0-.373.305-.675.68-.675s.68.302.68.675m-2.739.695a.79.79 0 0 0 .792-.786.79.79 0 0 0-.792-.786.79.79 0 0 0-.791.786c0 .434.354.786.791.786m-1.832 5.578a.407.407 0 0 1-.408.405.407.407 0 0 1-.408-.405c0-.223.182-.405.408-.405s.408.181.408.405m1.221.201a.496.496 0 0 0 .497-.494.496.496 0 0 0-.497-.495.496.496 0 0 0-.498.495c0 .273.223.494.498.494m2.354-1.236c0 .31-.253.562-.565.562a.564.564 0 0 1-.566-.562c0-.31.253-.562.566-.562s.565.252.565.562m-.135 2.361c.375 0 .68-.302.68-.675a.677.677 0 0 0-.68-.675.677.677 0 0 0-.68.675c0 .373.304.675.68.675m-1.608-.135c0 .31-.253.562-.566.562a.564.564 0 0 1-.565-.562c0-.31.253-.562.565-.562.313 0 .566.252.566.562m-2.488.538a.496.496 0 0 0 .498-.494.496.496 0 0 0-.498-.495.496.496 0 0 0-.498.495c0 .273.223.494.498.494m.588.991c0 .31-.254.562-.566.562a.564.564 0 0 1-.566-.562c0-.31.253-.562.566-.562s.566.252.566.562m1.742.855c.376 0 .68-.303.68-.675a.677.677 0 0 0-.68-.676.677.677 0 0 0-.68.675c0 .373.305.676.68.676m3.484-1.08a.79.79 0 0 1-.79.786.79.79 0 0 1-.792-.786c0-.435.354-.787.791-.787s.792.352.792.787Zm.794 2.743c.5 0 .906-.402.906-.9 0-.496-.406-.899-.906-.899s-.905.403-.905.9.405.9.905.9Zm-2.536-.518a.79.79 0 0 1-.792.786.79.79 0 0 1-.792-.787.79.79 0 0 1 .792-.786.79.79 0 0 1 .792.787m-2.669 2.316a.79.79 0 0 0 .791-.786.79.79 0 0 0-.792-.786.79.79 0 0 0-.791.786c0 .434.354.786.792.786m2.466 1.079c0 .497-.405.9-.905.9a.903.903 0 0 1-.906-.9c0-.496.405-.9.906-.9.5 0 .905.404.905.9M13.584 22a1.06 1.06 0 0 0 1.064-1.056 1.06 1.06 0 0 0-1.064-1.057 1.06 1.06 0 0 0-1.063 1.057A1.06 1.06 0 0 0 13.584 22m-1.379-2.788c0 .497-.405.9-.905.9a.903.903 0 0 1-.906-.9c0-.497.405-.9.905-.9s.906.403.906.9m3.123.54a1.06 1.06 0 0 0 1.063-1.057 1.06 1.06 0 0 0-1.063-1.056 1.06 1.06 0 0 0-1.064 1.056 1.06 1.06 0 0 0 1.064 1.057m-7.741-2.699a.677.677 0 0 1-.68.676.677.677 0 0 1-.68-.676c0-.373.305-.675.68-.675s.68.302.68.675"
482
+ }
483
+ )
484
+ }
485
+ );
480
486
  }
481
487
 
482
488
  // src/components/connect-modal/wallet-list/WalletList.css.ts
@@ -871,7 +877,7 @@ var import_react9 = require("react");
871
877
  var import_jsx_runtime20 = require("react/jsx-runtime");
872
878
  var IotaClientContext = (0, import_react9.createContext)(null);
873
879
  var DEFAULT_NETWORKS = {
874
- localnet: { url: (0, import_client.getNetwork)(import_client.Network.Local).url }
880
+ localnet: { url: (0, import_client.getNetwork)(import_client.Network.Localnet).url }
875
881
  };
876
882
  var DEFAULT_CREATE_CLIENT = function createClient(_name, config) {
877
883
  if ((0, import_client.isIotaClient)(config)) {