@multiplatform.one/web3 7.17.0 → 7.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -0
- package/dist/cjs/clients/adapter.cjs +33 -0
- package/dist/cjs/clients/adapter.native.js +36 -0
- package/dist/cjs/clients/adapter.native.js.map +1 -0
- package/dist/cjs/clients/bitcoin.cjs +46 -0
- package/dist/cjs/clients/bitcoin.native.js +51 -0
- package/dist/cjs/clients/bitcoin.native.js.map +1 -0
- package/dist/cjs/clients/connector.cjs +45 -0
- package/dist/cjs/clients/connector.native.js +49 -0
- package/dist/cjs/clients/connector.native.js.map +1 -0
- package/dist/cjs/clients/evm.cjs +171 -0
- package/dist/cjs/clients/evm.native.js +198 -0
- package/dist/cjs/clients/evm.native.js.map +1 -0
- package/dist/cjs/clients/gpg.cjs +31 -0
- package/dist/cjs/clients/gpg.native.js +34 -0
- package/dist/cjs/clients/gpg.native.js.map +1 -0
- package/dist/cjs/clients/hooks.cjs +78 -0
- package/dist/cjs/clients/hooks.native.js +85 -0
- package/dist/cjs/clients/hooks.native.js.map +1 -0
- package/dist/cjs/clients/index.cjs +49 -0
- package/dist/cjs/clients/index.native.js +52 -0
- package/dist/cjs/clients/index.native.js.map +1 -0
- package/dist/cjs/clients/solana.cjs +322 -0
- package/dist/cjs/clients/solana.native.js +511 -0
- package/dist/cjs/clients/solana.native.js.map +1 -0
- package/dist/cjs/clients/solanaMessage.cjs +38 -0
- package/dist/cjs/clients/solanaMessage.native.js +44 -0
- package/dist/cjs/clients/solanaMessage.native.js.map +1 -0
- package/dist/cjs/clients/sui.cjs +46 -0
- package/dist/cjs/clients/sui.native.js +51 -0
- package/dist/cjs/clients/sui.native.js.map +1 -0
- package/dist/cjs/clients/types.cjs +37 -0
- package/dist/cjs/clients/types.native.js +160 -0
- package/dist/cjs/clients/types.native.js.map +1 -0
- package/dist/cjs/clients/useSolanaClient.cjs +50 -0
- package/dist/cjs/clients/useSolanaClient.native.js +57 -0
- package/dist/cjs/clients/useSolanaClient.native.js.map +1 -0
- package/dist/cjs/clients/walletStandard.cjs +63 -0
- package/dist/cjs/clients/walletStandard.native.js +71 -0
- package/dist/cjs/clients/walletStandard.native.js.map +1 -0
- package/dist/cjs/connectkit/components/Common/ConnectorList/index.cjs +33 -5
- package/dist/cjs/connectkit/components/Common/ConnectorList/index.native.js +38 -5
- package/dist/cjs/connectkit/components/Common/ConnectorList/index.native.js.map +1 -1
- package/dist/cjs/connectkit/components/ConnectButton/index.cjs +5 -0
- package/dist/cjs/connectkit/components/ConnectButton/index.native.js +5 -0
- package/dist/cjs/connectkit/components/ConnectButton/index.native.js.map +1 -1
- package/dist/cjs/connectkit/components/ConnectModal/ConnectWithInjector/index.cjs +9 -4
- package/dist/cjs/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js +12 -7
- package/dist/cjs/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js.map +1 -1
- package/dist/cjs/connectkit/connectors/walletAdapterConnector.cjs +2 -0
- package/dist/cjs/connectkit/connectors/walletAdapterConnector.native.js +2 -0
- package/dist/cjs/connectkit/connectors/walletAdapterConnector.native.js.map +1 -1
- package/dist/cjs/connectkit/index.cjs +5 -0
- package/dist/cjs/connectkit/index.native.js +5 -0
- package/dist/cjs/connectkit/index.native.js.map +1 -1
- package/dist/cjs/connectkit/openConnector/context.cjs +146 -0
- package/dist/cjs/connectkit/openConnector/context.native.js +188 -0
- package/dist/cjs/connectkit/openConnector/context.native.js.map +1 -0
- package/dist/cjs/connectkit/openConnector/device.cjs +42 -0
- package/dist/cjs/connectkit/openConnector/device.native.js +51 -0
- package/dist/cjs/connectkit/openConnector/device.native.js.map +1 -0
- package/dist/cjs/connectkit/openConnector/index.cjs +35 -0
- package/dist/cjs/connectkit/openConnector/index.native.js +38 -0
- package/dist/cjs/connectkit/openConnector/index.native.js.map +1 -0
- package/dist/cjs/connectkit/openConnector/launcher.cjs +133 -0
- package/dist/cjs/connectkit/openConnector/launcher.native.js +158 -0
- package/dist/cjs/connectkit/openConnector/launcher.native.js.map +1 -0
- package/dist/cjs/connectkit/screens.cjs +1 -10
- package/dist/cjs/connectkit/screens.native.js +1 -12
- package/dist/cjs/connectkit/screens.native.js.map +1 -1
- package/dist/cjs/connectkit/siwe/SIWEProvider.cjs +4 -5
- package/dist/cjs/connectkit/siwe/SIWEProvider.native.js +4 -5
- package/dist/cjs/connectkit/siwe/SIWEProvider.native.js.map +1 -1
- package/dist/cjs/connectkit/siwe/connectIntent.cjs +9 -5
- package/dist/cjs/connectkit/siwe/connectIntent.native.js +10 -3
- package/dist/cjs/connectkit/siwe/connectIntent.native.js.map +1 -1
- package/dist/cjs/connectkit/useWeb3Modal.cjs +21 -0
- package/dist/cjs/connectkit/useWeb3Modal.native.js +22 -0
- package/dist/cjs/connectkit/useWeb3Modal.native.js.map +1 -1
- package/dist/cjs/connectkit/web3Bridge.cjs +4 -1
- package/dist/cjs/connectkit/web3Bridge.native.js +4 -1
- package/dist/cjs/connectkit/web3Bridge.native.js.map +1 -1
- package/dist/cjs/connectkit/web3Provider.native.js.map +1 -1
- package/dist/cjs/index.cjs +2 -1
- package/dist/cjs/index.native.js +1 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/solana.cjs +41 -0
- package/dist/cjs/solana.native.js +44 -0
- package/dist/cjs/solana.native.js.map +1 -0
- package/dist/esm/clients/adapter.mjs +8 -0
- package/dist/esm/clients/adapter.mjs.map +1 -0
- package/dist/esm/clients/adapter.native.js +8 -0
- package/dist/esm/clients/adapter.native.js.map +1 -0
- package/dist/esm/clients/bitcoin.mjs +21 -0
- package/dist/esm/clients/bitcoin.mjs.map +1 -0
- package/dist/esm/clients/bitcoin.native.js +23 -0
- package/dist/esm/clients/bitcoin.native.js.map +1 -0
- package/dist/esm/clients/connector.mjs +20 -0
- package/dist/esm/clients/connector.mjs.map +1 -0
- package/dist/esm/clients/connector.native.js +21 -0
- package/dist/esm/clients/connector.native.js.map +1 -0
- package/dist/esm/clients/evm.mjs +146 -0
- package/dist/esm/clients/evm.mjs.map +1 -0
- package/dist/esm/clients/evm.native.js +170 -0
- package/dist/esm/clients/evm.native.js.map +1 -0
- package/dist/esm/clients/gpg.mjs +3 -0
- package/dist/esm/clients/gpg.mjs.map +1 -0
- package/dist/esm/clients/gpg.native.js +3 -0
- package/dist/esm/clients/gpg.native.js.map +1 -0
- package/dist/esm/clients/hooks.mjs +51 -0
- package/dist/esm/clients/hooks.mjs.map +1 -0
- package/dist/esm/clients/hooks.native.js +55 -0
- package/dist/esm/clients/hooks.native.js.map +1 -0
- package/dist/esm/clients/index.mjs +11 -0
- package/dist/esm/clients/index.mjs.map +1 -0
- package/dist/esm/clients/index.native.js +11 -0
- package/dist/esm/clients/index.native.js.map +1 -0
- package/dist/esm/clients/solana.mjs +289 -0
- package/dist/esm/clients/solana.mjs.map +1 -0
- package/dist/esm/clients/solana.native.js +475 -0
- package/dist/esm/clients/solana.native.js.map +1 -0
- package/dist/esm/clients/solanaMessage.mjs +13 -0
- package/dist/esm/clients/solanaMessage.mjs.map +1 -0
- package/dist/esm/clients/solanaMessage.native.js +16 -0
- package/dist/esm/clients/solanaMessage.native.js.map +1 -0
- package/dist/esm/clients/sui.mjs +21 -0
- package/dist/esm/clients/sui.mjs.map +1 -0
- package/dist/esm/clients/sui.native.js +23 -0
- package/dist/esm/clients/sui.native.js.map +1 -0
- package/dist/esm/clients/types.mjs +12 -0
- package/dist/esm/clients/types.mjs.map +1 -0
- package/dist/esm/clients/types.native.js +132 -0
- package/dist/esm/clients/types.native.js.map +1 -0
- package/dist/esm/clients/useSolanaClient.mjs +25 -0
- package/dist/esm/clients/useSolanaClient.mjs.map +1 -0
- package/dist/esm/clients/useSolanaClient.native.js +29 -0
- package/dist/esm/clients/useSolanaClient.native.js.map +1 -0
- package/dist/esm/clients/walletStandard.mjs +33 -0
- package/dist/esm/clients/walletStandard.mjs.map +1 -0
- package/dist/esm/clients/walletStandard.native.js +38 -0
- package/dist/esm/clients/walletStandard.native.js.map +1 -0
- package/dist/esm/connectkit/components/Common/ConnectorList/index.mjs +34 -6
- package/dist/esm/connectkit/components/Common/ConnectorList/index.mjs.map +1 -1
- package/dist/esm/connectkit/components/Common/ConnectorList/index.native.js +39 -6
- package/dist/esm/connectkit/components/Common/ConnectorList/index.native.js.map +1 -1
- package/dist/esm/connectkit/components/ConnectButton/index.mjs +5 -0
- package/dist/esm/connectkit/components/ConnectButton/index.mjs.map +1 -1
- package/dist/esm/connectkit/components/ConnectButton/index.native.js +5 -0
- package/dist/esm/connectkit/components/ConnectButton/index.native.js.map +1 -1
- package/dist/esm/connectkit/components/ConnectModal/ConnectWithInjector/index.mjs +9 -4
- package/dist/esm/connectkit/components/ConnectModal/ConnectWithInjector/index.mjs.map +1 -1
- package/dist/esm/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js +12 -7
- package/dist/esm/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js.map +1 -1
- package/dist/esm/connectkit/connectors/walletAdapterConnector.mjs +2 -0
- package/dist/esm/connectkit/connectors/walletAdapterConnector.mjs.map +1 -1
- package/dist/esm/connectkit/connectors/walletAdapterConnector.native.js +2 -0
- package/dist/esm/connectkit/connectors/walletAdapterConnector.native.js.map +1 -1
- package/dist/esm/connectkit/index.mjs +3 -1
- package/dist/esm/connectkit/index.mjs.map +1 -1
- package/dist/esm/connectkit/index.native.js +3 -1
- package/dist/esm/connectkit/index.native.js.map +1 -1
- package/dist/esm/connectkit/openConnector/context.mjs +118 -0
- package/dist/esm/connectkit/openConnector/context.mjs.map +1 -0
- package/dist/esm/connectkit/openConnector/context.native.js +146 -0
- package/dist/esm/connectkit/openConnector/context.native.js.map +1 -0
- package/dist/esm/connectkit/openConnector/device.mjs +16 -0
- package/dist/esm/connectkit/openConnector/device.mjs.map +1 -0
- package/dist/esm/connectkit/openConnector/device.native.js +22 -0
- package/dist/esm/connectkit/openConnector/device.native.js.map +1 -0
- package/dist/esm/connectkit/openConnector/index.mjs +4 -0
- package/dist/esm/connectkit/openConnector/index.mjs.map +1 -0
- package/dist/esm/connectkit/openConnector/index.native.js +4 -0
- package/dist/esm/connectkit/openConnector/index.native.js.map +1 -0
- package/dist/esm/connectkit/openConnector/launcher.mjs +106 -0
- package/dist/esm/connectkit/openConnector/launcher.mjs.map +1 -0
- package/dist/esm/connectkit/openConnector/launcher.native.js +128 -0
- package/dist/esm/connectkit/openConnector/launcher.native.js.map +1 -0
- package/dist/esm/connectkit/screens.mjs +2 -11
- package/dist/esm/connectkit/screens.mjs.map +1 -1
- package/dist/esm/connectkit/screens.native.js +2 -13
- package/dist/esm/connectkit/screens.native.js.map +1 -1
- package/dist/esm/connectkit/siwe/SIWEProvider.mjs +4 -5
- package/dist/esm/connectkit/siwe/SIWEProvider.mjs.map +1 -1
- package/dist/esm/connectkit/siwe/SIWEProvider.native.js +4 -5
- package/dist/esm/connectkit/siwe/SIWEProvider.native.js.map +1 -1
- package/dist/esm/connectkit/siwe/connectIntent.mjs +9 -6
- package/dist/esm/connectkit/siwe/connectIntent.mjs.map +1 -1
- package/dist/esm/connectkit/siwe/connectIntent.native.js +10 -4
- package/dist/esm/connectkit/siwe/connectIntent.native.js.map +1 -1
- package/dist/esm/connectkit/useWeb3Modal.mjs +22 -1
- package/dist/esm/connectkit/useWeb3Modal.mjs.map +1 -1
- package/dist/esm/connectkit/useWeb3Modal.native.js +23 -1
- package/dist/esm/connectkit/useWeb3Modal.native.js.map +1 -1
- package/dist/esm/connectkit/web3Bridge.mjs +4 -1
- package/dist/esm/connectkit/web3Bridge.mjs.map +1 -1
- package/dist/esm/connectkit/web3Bridge.native.js +4 -1
- package/dist/esm/connectkit/web3Bridge.native.js.map +1 -1
- package/dist/esm/connectkit/web3Provider.mjs.map +1 -1
- package/dist/esm/connectkit/web3Provider.native.js.map +1 -1
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +1 -0
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/solana.mjs +5 -0
- package/dist/esm/solana.mjs.map +1 -0
- package/dist/esm/solana.native.js +5 -0
- package/dist/esm/solana.native.js.map +1 -0
- package/dist/jsx/clients/adapter.mjs +8 -0
- package/dist/jsx/clients/adapter.mjs.map +1 -0
- package/dist/jsx/clients/adapter.native.js +36 -0
- package/dist/jsx/clients/adapter.native.js.map +1 -0
- package/dist/jsx/clients/bitcoin.mjs +21 -0
- package/dist/jsx/clients/bitcoin.mjs.map +1 -0
- package/dist/jsx/clients/bitcoin.native.js +51 -0
- package/dist/jsx/clients/bitcoin.native.js.map +1 -0
- package/dist/jsx/clients/connector.mjs +20 -0
- package/dist/jsx/clients/connector.mjs.map +1 -0
- package/dist/jsx/clients/connector.native.js +49 -0
- package/dist/jsx/clients/connector.native.js.map +1 -0
- package/dist/jsx/clients/evm.mjs +146 -0
- package/dist/jsx/clients/evm.mjs.map +1 -0
- package/dist/jsx/clients/evm.native.js +198 -0
- package/dist/jsx/clients/evm.native.js.map +1 -0
- package/dist/jsx/clients/gpg.mjs +3 -0
- package/dist/jsx/clients/gpg.mjs.map +1 -0
- package/dist/jsx/clients/gpg.native.js +34 -0
- package/dist/jsx/clients/gpg.native.js.map +1 -0
- package/dist/jsx/clients/hooks.mjs +51 -0
- package/dist/jsx/clients/hooks.mjs.map +1 -0
- package/dist/jsx/clients/hooks.native.js +85 -0
- package/dist/jsx/clients/hooks.native.js.map +1 -0
- package/dist/jsx/clients/index.mjs +11 -0
- package/dist/jsx/clients/index.mjs.map +1 -0
- package/dist/jsx/clients/index.native.js +52 -0
- package/dist/jsx/clients/index.native.js.map +1 -0
- package/dist/jsx/clients/solana.mjs +289 -0
- package/dist/jsx/clients/solana.mjs.map +1 -0
- package/dist/jsx/clients/solana.native.js +511 -0
- package/dist/jsx/clients/solana.native.js.map +1 -0
- package/dist/jsx/clients/solanaMessage.mjs +13 -0
- package/dist/jsx/clients/solanaMessage.mjs.map +1 -0
- package/dist/jsx/clients/solanaMessage.native.js +44 -0
- package/dist/jsx/clients/solanaMessage.native.js.map +1 -0
- package/dist/jsx/clients/sui.mjs +21 -0
- package/dist/jsx/clients/sui.mjs.map +1 -0
- package/dist/jsx/clients/sui.native.js +51 -0
- package/dist/jsx/clients/sui.native.js.map +1 -0
- package/dist/jsx/clients/types.mjs +12 -0
- package/dist/jsx/clients/types.mjs.map +1 -0
- package/dist/jsx/clients/types.native.js +160 -0
- package/dist/jsx/clients/types.native.js.map +1 -0
- package/dist/jsx/clients/useSolanaClient.mjs +25 -0
- package/dist/jsx/clients/useSolanaClient.mjs.map +1 -0
- package/dist/jsx/clients/useSolanaClient.native.js +57 -0
- package/dist/jsx/clients/useSolanaClient.native.js.map +1 -0
- package/dist/jsx/clients/walletStandard.mjs +33 -0
- package/dist/jsx/clients/walletStandard.mjs.map +1 -0
- package/dist/jsx/clients/walletStandard.native.js +71 -0
- package/dist/jsx/clients/walletStandard.native.js.map +1 -0
- package/dist/jsx/connectkit/components/Common/ConnectorList/index.mjs +34 -6
- package/dist/jsx/connectkit/components/Common/ConnectorList/index.mjs.map +1 -1
- package/dist/jsx/connectkit/components/Common/ConnectorList/index.native.js +38 -5
- package/dist/jsx/connectkit/components/Common/ConnectorList/index.native.js.map +1 -1
- package/dist/jsx/connectkit/components/ConnectButton/index.mjs +5 -0
- package/dist/jsx/connectkit/components/ConnectButton/index.mjs.map +1 -1
- package/dist/jsx/connectkit/components/ConnectButton/index.native.js +5 -0
- package/dist/jsx/connectkit/components/ConnectButton/index.native.js.map +1 -1
- package/dist/jsx/connectkit/components/ConnectModal/ConnectWithInjector/index.mjs +9 -4
- package/dist/jsx/connectkit/components/ConnectModal/ConnectWithInjector/index.mjs.map +1 -1
- package/dist/jsx/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js +12 -7
- package/dist/jsx/connectkit/components/ConnectModal/ConnectWithInjector/index.native.js.map +1 -1
- package/dist/jsx/connectkit/connectors/walletAdapterConnector.mjs +2 -0
- package/dist/jsx/connectkit/connectors/walletAdapterConnector.mjs.map +1 -1
- package/dist/jsx/connectkit/connectors/walletAdapterConnector.native.js +2 -0
- package/dist/jsx/connectkit/connectors/walletAdapterConnector.native.js.map +1 -1
- package/dist/jsx/connectkit/index.mjs +3 -1
- package/dist/jsx/connectkit/index.mjs.map +1 -1
- package/dist/jsx/connectkit/index.native.js +5 -0
- package/dist/jsx/connectkit/index.native.js.map +1 -1
- package/dist/jsx/connectkit/openConnector/context.mjs +118 -0
- package/dist/jsx/connectkit/openConnector/context.mjs.map +1 -0
- package/dist/jsx/connectkit/openConnector/context.native.js +188 -0
- package/dist/jsx/connectkit/openConnector/context.native.js.map +1 -0
- package/dist/jsx/connectkit/openConnector/device.mjs +16 -0
- package/dist/jsx/connectkit/openConnector/device.mjs.map +1 -0
- package/dist/jsx/connectkit/openConnector/device.native.js +51 -0
- package/dist/jsx/connectkit/openConnector/device.native.js.map +1 -0
- package/dist/jsx/connectkit/openConnector/index.mjs +4 -0
- package/dist/jsx/connectkit/openConnector/index.mjs.map +1 -0
- package/dist/jsx/connectkit/openConnector/index.native.js +38 -0
- package/dist/jsx/connectkit/openConnector/index.native.js.map +1 -0
- package/dist/jsx/connectkit/openConnector/launcher.mjs +106 -0
- package/dist/jsx/connectkit/openConnector/launcher.mjs.map +1 -0
- package/dist/jsx/connectkit/openConnector/launcher.native.js +158 -0
- package/dist/jsx/connectkit/openConnector/launcher.native.js.map +1 -0
- package/dist/jsx/connectkit/screens.mjs +2 -11
- package/dist/jsx/connectkit/screens.mjs.map +1 -1
- package/dist/jsx/connectkit/screens.native.js +1 -12
- package/dist/jsx/connectkit/screens.native.js.map +1 -1
- package/dist/jsx/connectkit/siwe/SIWEProvider.mjs +4 -5
- package/dist/jsx/connectkit/siwe/SIWEProvider.mjs.map +1 -1
- package/dist/jsx/connectkit/siwe/SIWEProvider.native.js +4 -5
- package/dist/jsx/connectkit/siwe/SIWEProvider.native.js.map +1 -1
- package/dist/jsx/connectkit/siwe/connectIntent.mjs +9 -6
- package/dist/jsx/connectkit/siwe/connectIntent.mjs.map +1 -1
- package/dist/jsx/connectkit/siwe/connectIntent.native.js +10 -3
- package/dist/jsx/connectkit/siwe/connectIntent.native.js.map +1 -1
- package/dist/jsx/connectkit/useWeb3Modal.mjs +22 -1
- package/dist/jsx/connectkit/useWeb3Modal.mjs.map +1 -1
- package/dist/jsx/connectkit/useWeb3Modal.native.js +22 -0
- package/dist/jsx/connectkit/useWeb3Modal.native.js.map +1 -1
- package/dist/jsx/connectkit/web3Bridge.mjs +4 -1
- package/dist/jsx/connectkit/web3Bridge.mjs.map +1 -1
- package/dist/jsx/connectkit/web3Bridge.native.js +4 -1
- package/dist/jsx/connectkit/web3Bridge.native.js.map +1 -1
- package/dist/jsx/connectkit/web3Provider.mjs.map +1 -1
- package/dist/jsx/connectkit/web3Provider.native.js.map +1 -1
- package/dist/jsx/index.js +1 -0
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +1 -0
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +1 -0
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/solana.mjs +5 -0
- package/dist/jsx/solana.mjs.map +1 -0
- package/dist/jsx/solana.native.js +44 -0
- package/dist/jsx/solana.native.js.map +1 -0
- package/package.json +14 -6
- package/src/clients/adapter.ts +13 -0
- package/src/clients/bitcoin.ts +42 -0
- package/src/clients/connector.spec.ts +78 -0
- package/src/clients/connector.ts +36 -0
- package/src/clients/evm.spec.ts +265 -0
- package/src/clients/evm.ts +223 -0
- package/src/clients/gpg.spec.ts +169 -0
- package/src/clients/gpg.ts +8 -0
- package/src/clients/hooks.spec.tsx +113 -0
- package/src/clients/hooks.ts +51 -0
- package/src/clients/index.ts +40 -0
- package/src/clients/solana.spec.ts +444 -0
- package/src/clients/solana.ts +465 -0
- package/src/clients/solanaMessage.ts +34 -0
- package/src/clients/sui.ts +42 -0
- package/src/clients/types.ts +40 -0
- package/src/clients/useSolanaClient.ts +31 -0
- package/src/clients/walletStandard.ts +87 -0
- package/src/connectkit/components/Common/ConnectorList/index.tsx +30 -2
- package/src/connectkit/components/ConnectButton/index.tsx +5 -0
- package/src/connectkit/components/ConnectModal/ConnectWithInjector/index.tsx +13 -8
- package/src/connectkit/connectors/walletAdapterConnector.ts +2 -0
- package/src/connectkit/index.ts +8 -0
- package/src/connectkit/openConnector/context.tsx +176 -0
- package/src/connectkit/openConnector/device.spec.ts +86 -0
- package/src/connectkit/openConnector/device.ts +37 -0
- package/src/connectkit/openConnector/index.ts +18 -0
- package/src/connectkit/openConnector/launcher.spec.ts +325 -0
- package/src/connectkit/openConnector/launcher.ts +203 -0
- package/src/connectkit/openConnector/modal.spec.tsx +330 -0
- package/src/connectkit/screens.tsx +2 -11
- package/src/connectkit/siwe/SIWEProvider.spec.tsx +112 -0
- package/src/connectkit/siwe/SIWEProvider.tsx +6 -10
- package/src/connectkit/siwe/connectIntent.spec.ts +90 -0
- package/src/connectkit/siwe/connectIntent.ts +19 -6
- package/src/connectkit/useWeb3Modal.ts +25 -1
- package/src/connectkit/web3Bridge.tsx +4 -1
- package/src/connectkit/web3Provider.tsx +4 -1
- package/src/index.ts +4 -0
- package/src/solana.ts +30 -0
- package/types/clients/adapter.d.ts +5 -0
- package/types/clients/adapter.d.ts.map +1 -0
- package/types/clients/bitcoin.d.ts +21 -0
- package/types/clients/bitcoin.d.ts.map +1 -0
- package/types/clients/connector.d.ts +14 -0
- package/types/clients/connector.d.ts.map +1 -0
- package/types/clients/evm.d.ts +68 -0
- package/types/clients/evm.d.ts.map +1 -0
- package/types/clients/gpg.d.ts +2 -0
- package/types/clients/gpg.d.ts.map +1 -0
- package/types/clients/hooks.d.ts +16 -0
- package/types/clients/hooks.d.ts.map +1 -0
- package/types/clients/index.d.ts +10 -0
- package/types/clients/index.d.ts.map +1 -0
- package/types/clients/solana.d.ts +111 -0
- package/types/clients/solana.d.ts.map +1 -0
- package/types/clients/solanaMessage.d.ts +18 -0
- package/types/clients/solanaMessage.d.ts.map +1 -0
- package/types/clients/sui.d.ts +21 -0
- package/types/clients/sui.d.ts.map +1 -0
- package/types/clients/types.d.ts +27 -0
- package/types/clients/types.d.ts.map +1 -0
- package/types/clients/useSolanaClient.d.ts +11 -0
- package/types/clients/useSolanaClient.d.ts.map +1 -0
- package/types/clients/walletStandard.d.ts +63 -0
- package/types/clients/walletStandard.d.ts.map +1 -0
- package/types/connectkit/components/Common/ConnectorList/index.d.ts.map +1 -1
- package/types/connectkit/components/ConnectButton/index.d.ts.map +1 -1
- package/types/connectkit/components/ConnectModal/ConnectWithInjector/index.d.ts.map +1 -1
- package/types/connectkit/connectors/walletAdapterConnector.d.ts.map +1 -1
- package/types/connectkit/index.d.ts +2 -0
- package/types/connectkit/index.d.ts.map +1 -1
- package/types/connectkit/openConnector/context.d.ts +48 -0
- package/types/connectkit/openConnector/context.d.ts.map +1 -0
- package/types/connectkit/openConnector/device.d.ts +18 -0
- package/types/connectkit/openConnector/device.d.ts.map +1 -0
- package/types/connectkit/openConnector/index.d.ts +3 -0
- package/types/connectkit/openConnector/index.d.ts.map +1 -0
- package/types/connectkit/openConnector/launcher.d.ts +64 -0
- package/types/connectkit/openConnector/launcher.d.ts.map +1 -0
- package/types/connectkit/screens.d.ts.map +1 -1
- package/types/connectkit/siwe/SIWEProvider.d.ts.map +1 -1
- package/types/connectkit/siwe/connectIntent.d.ts +8 -3
- package/types/connectkit/siwe/connectIntent.d.ts.map +1 -1
- package/types/connectkit/useWeb3Modal.d.ts +16 -0
- package/types/connectkit/useWeb3Modal.d.ts.map +1 -1
- package/types/connectkit/web3Bridge.d.ts.map +1 -1
- package/types/connectkit/web3Provider.d.ts +4 -1
- package/types/connectkit/web3Provider.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/solana.d.ts +4 -0
- package/types/solana.d.ts.map +1 -0
package/README.md
CHANGED
|
@@ -24,6 +24,66 @@ Peers: `react`, `@tanstack/react-query`.
|
|
|
24
24
|
`WalletStatus`, `NetworkSwitcher`
|
|
25
25
|
- **Subpaths** — `./native` (WebView wallet bridge), `./connectkit`
|
|
26
26
|
|
|
27
|
+
## Per-chain clients
|
|
28
|
+
|
|
29
|
+
Apps talk to a chain through a client, never through wagmi, `window.ethereum`
|
|
30
|
+
or a provider's `request`. Every client shares
|
|
31
|
+
`{ family, address, chainId?, capabilities, signMessage(message) }`, and
|
|
32
|
+
`signMessage` returns the family's native signature, the one the Keycloak
|
|
33
|
+
verifiers take: EVM 0x hex, Solana base58, Sui base64, Bitcoin base64 BIP-322,
|
|
34
|
+
GPG the armored signature plus the armored public key.
|
|
35
|
+
|
|
36
|
+
| Hook / factory | What it adds |
|
|
37
|
+
| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
38
|
+
| `useEvmClient()` / `evmClient({ walletClient } \| { provider, account, chain })` | viem `walletClient` + `publicClient`, `sendTransaction`, `writeContract`, `waitForTransactionReceipt`, `erc20.{transfer, approve, ensureAllowance, balanceOf, allowance, decimals}`, safe for tokens like USDT that return nothing or refuse a non-zero to non-zero approve |
|
|
39
|
+
| `useSolanaClient()` / `solanaClient({ signer, rpcUrl?, chain? })` from `./solana` | web only: `@solana/kit` `rpc`, `signTransaction`, `signAndSendTransaction`, `sendTransaction`, `confirmTransaction`, `getBalance`, `transferSol` |
|
|
40
|
+
| `useGpgSigner()` / `createGpgSigner()` | the copy/paste GPG signer: `signMessage` parks a request with its terminal `command`; `submit(pasted, request)` resolves it only while `request` is still the pending one and the pasted signature covers its message |
|
|
41
|
+
| `useSuiClient()`, `useBitcoinClient()` | message signing only; `signTransaction` / `signPsbt` reject with `UnsupportedClientMethodError` until transactions land |
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { useEvmClient } from "@multiplatform.one/web3";
|
|
45
|
+
import { useSolanaClient } from "@multiplatform.one/web3/solana";
|
|
46
|
+
|
|
47
|
+
const evm = useEvmClient();
|
|
48
|
+
await evm?.erc20.ensureAllowance({ token: qcc, spender: store, amount });
|
|
49
|
+
await evm?.writeContract({ address: store, abi, functionName: "buy", args: [packageId] });
|
|
50
|
+
|
|
51
|
+
const sol = useSolanaClient();
|
|
52
|
+
const sent = await sol?.transferSol({ to, lamports: 1_000_000n });
|
|
53
|
+
await sol?.confirmTransaction(sent!);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`transferSol` returns the signature with the blockhash's `lastValidBlockHeight`,
|
|
57
|
+
and `confirmTransaction` waits until the chain passes that height before it
|
|
58
|
+
gives up. Its `SolanaConfirmationError` has `mayStillLand`: `false` means the
|
|
59
|
+
transaction failed or expired and a retry is safe; `true` (only when there was
|
|
60
|
+
no `lastValidBlockHeight` to judge by) means resending can pay twice.
|
|
61
|
+
|
|
62
|
+
A Solana client runs over a byte-level `SolanaSigner`: `standardSolanaSigner`
|
|
63
|
+
(Wallet Standard: Phantom, Solflare, Backpack), `injectedSolanaSigner` (what the
|
|
64
|
+
modal connected), or `connectSolanaWallet()` without the modal. RPC defaults to
|
|
65
|
+
`Web3Config.solanaRpcUrl`.
|
|
66
|
+
|
|
67
|
+
The Solana client is the web-only `@multiplatform.one/web3/solana` subpath, with
|
|
68
|
+
no `react-native` condition. The root is also the native entry, and a native app
|
|
69
|
+
signs Solana through the WebView bridge, so the root never imports
|
|
70
|
+
`@solana/kit`. Sign-in does not need it either: `SIWEProvider` signs Solana
|
|
71
|
+
through `solanaMessageClient`, so a login page carries no kit.
|
|
72
|
+
`tests/clients/importGraph.spec.ts` holds both lines, for native and web.
|
|
73
|
+
|
|
74
|
+
### Solana on mobile (follow-up)
|
|
75
|
+
|
|
76
|
+
The web path is done. A native app cannot reach Phantom through the WebView
|
|
77
|
+
bridge alone: the WebView has no injected Phantom, and a dapp opened inside
|
|
78
|
+
Phantom's in-app browser can never hand control back to the calling app. The
|
|
79
|
+
chosen direction is Phantom's deeplink protocol (Solflare speaks the same one),
|
|
80
|
+
bridged to the WebView like every other native signer and never a native module: an X25519 keypair per session, `connect`,
|
|
81
|
+
`signMessage`, `signTransaction` and `signAndSendTransaction` sent to
|
|
82
|
+
`https://phantom.app/ul/v1/<method>` with a `redirect_link` back into the app,
|
|
83
|
+
payloads sealed with NaCl box, and the session token kept for later calls. The
|
|
84
|
+
native host owns `Linking`; the client, the modal and login stay unchanged.
|
|
85
|
+
Android can later add Solana Mobile Wallet Adapter as a second signer.
|
|
86
|
+
|
|
27
87
|
## What it must not do
|
|
28
88
|
|
|
29
89
|
- No modal shell — the modal UI lives in `@multiplatform.one/connectkit`;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var adapter_exports = {};
|
|
24
|
+
__export(adapter_exports, {
|
|
25
|
+
connectorAdapter: () => connectorAdapter
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(adapter_exports);
|
|
28
|
+
function connectorAdapter(connector, ecosystem) {
|
|
29
|
+
const c = connector;
|
|
30
|
+
if (!c?.adapter || !c.ecosystem || c.ecosystem === "evm") return null;
|
|
31
|
+
if (ecosystem && c.ecosystem !== ecosystem) return null;
|
|
32
|
+
return c.adapter;
|
|
33
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var adapter_exports = {};
|
|
26
|
+
__export(adapter_exports, {
|
|
27
|
+
connectorAdapter: () => connectorAdapter
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(adapter_exports);
|
|
30
|
+
function connectorAdapter(connector, ecosystem) {
|
|
31
|
+
var c = connector;
|
|
32
|
+
if (!(c === null || c === void 0 ? void 0 : c.adapter) || !c.ecosystem || c.ecosystem === "evm") return null;
|
|
33
|
+
if (ecosystem && c.ecosystem !== ecosystem) return null;
|
|
34
|
+
return c.adapter;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=adapter.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","adapter_exports","__export","connectorAdapter","module","exports","connector","ecosystem","c","adapter"],"sources":["../../../src/clients/adapter.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,eAAA;AAAAC,QAAA,CAAAD,eAAA;EAAAE,gBAAA,EAAAA,CAAA,KAAAA;AAAA;AAIOC,MAAA,CAAAC,OAAS,GAAAT,YACd,CAAAK,eACA;AAEA,SAAME,gBAAIA,CAAAG,SAAA,EAAAC,SAAA;EACV,IAAIC,CAAC,GAAGF,SAAA;EACR,IAAI,EAAAE,CAAA,aAAeA,CAAA,cAAc,SAAWA,CAAA,CAAAC,OAAO,MAAAD,CAAA,CAAAD,SAAA,IAAAC,CAAA,CAAAD,SAAA;EACnD,IAAAA,SAAS,IAAAC,CAAA,CAAAD,SAAA,KAAAA,SAAA;EACX,OAAAC,CAAA,CAAAC,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var bitcoin_exports = {};
|
|
24
|
+
__export(bitcoin_exports, {
|
|
25
|
+
bitcoinClient: () => bitcoinClient
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(bitcoin_exports);
|
|
28
|
+
var import_types = require("./types.cjs");
|
|
29
|
+
const txTodo = "needs PSBT signing through the wallet (Unisat/OKX signPsbt, Phantom's bitcoin signPSBT) and a broadcast endpoint";
|
|
30
|
+
const capabilities = ["signMessage"];
|
|
31
|
+
function bitcoinClient(adapter) {
|
|
32
|
+
if (!adapter.address) throw new Error("bitcoinClient: connect a Bitcoin wallet first");
|
|
33
|
+
return {
|
|
34
|
+
family: "bitcoin",
|
|
35
|
+
address: adapter.address,
|
|
36
|
+
chainId: "bitcoin",
|
|
37
|
+
capabilities,
|
|
38
|
+
signMessage: message => adapter.signMessage(message),
|
|
39
|
+
signPsbt: async () => {
|
|
40
|
+
throw new import_types.UnsupportedClientMethodError("bitcoin", "signPsbt", txTodo);
|
|
41
|
+
},
|
|
42
|
+
sendBitcoin: async () => {
|
|
43
|
+
throw new import_types.UnsupportedClientMethodError("bitcoin", "sendBitcoin", txTodo);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var bitcoin_exports = {};
|
|
26
|
+
__export(bitcoin_exports, {
|
|
27
|
+
bitcoinClient: () => bitcoinClient
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(bitcoin_exports);
|
|
30
|
+
var import_types = require("./types.native.js");
|
|
31
|
+
var txTodo = "needs PSBT signing through the wallet (Unisat/OKX signPsbt, Phantom's bitcoin signPSBT) and a broadcast endpoint";
|
|
32
|
+
var capabilities = ["signMessage"];
|
|
33
|
+
function bitcoinClient(adapter) {
|
|
34
|
+
if (!adapter.address) throw new Error("bitcoinClient: connect a Bitcoin wallet first");
|
|
35
|
+
return {
|
|
36
|
+
family: "bitcoin",
|
|
37
|
+
address: adapter.address,
|
|
38
|
+
chainId: "bitcoin",
|
|
39
|
+
capabilities,
|
|
40
|
+
signMessage: function signMessage(message) {
|
|
41
|
+
return adapter.signMessage(message);
|
|
42
|
+
},
|
|
43
|
+
signPsbt: async function signPsbt() {
|
|
44
|
+
throw new import_types.UnsupportedClientMethodError("bitcoin", "signPsbt", txTodo);
|
|
45
|
+
},
|
|
46
|
+
sendBitcoin: async function sendBitcoin() {
|
|
47
|
+
throw new import_types.UnsupportedClientMethodError("bitcoin", "sendBitcoin", txTodo);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=bitcoin.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","bitcoin_exports","__export","bitcoinClient","module","exports","import_types","require","txTodo","capabilities","adapter","address","Error","family","chainId","signMessage","message","signPsbt","UnsupportedClientMethodError"],"sources":["../../../src/clients/bitcoin.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,eAAA;AAAAC,QAAA,CAAAD,eAAA;EAAAE,aAAA,EAAAA,CAAA,KAAAA;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAT,YAAsF,CAAAK,eAAA;AAItF,IAAAK,YACE,GAAAC,OAAA;AAkBF,IAAAC,MAAM,qHAA0D;AAEzD,IAAAC,YAAS,IACd,aAAa,CACb;AAAO,SACLN,aAAQA,CAAAO,OAAA;EAAA,IACR,CAAAA,OAAS,CAAAC,OAAQ,YAAAC,KAAA;EAAA,OACjB;IACAC,MAAA;IACAF,OAAA,EAAAD,OAAc,CAAAC,OAAA;IACdG,OAAA,WAAU;IACRL,YAAU;IACZM,WAAA,WAAAA,YAAAC,OAAA;MACA,OAAAN,OAAa,CAAAK,WAAY,CAAAC,OAAA;IACvB;IACFC,QAAA,iBAAAA,SAAA;MACF,UAAAX,YAAA,CAAAY,4BAAA,wBAAAV,MAAA;IACF","ignoreList":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var connector_exports = {};
|
|
24
|
+
__export(connector_exports, {
|
|
25
|
+
clientForConnector: () => clientForConnector
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(connector_exports);
|
|
28
|
+
var import_adapter = require("./adapter.cjs");
|
|
29
|
+
var import_bitcoin = require("./bitcoin.cjs");
|
|
30
|
+
var import_solanaMessage = require("./solanaMessage.cjs");
|
|
31
|
+
var import_sui = require("./sui.cjs");
|
|
32
|
+
function clientForConnector(connector, options = {}) {
|
|
33
|
+
const adapter = (0, import_adapter.connectorAdapter)(connector);
|
|
34
|
+
if (!adapter?.address) return null;
|
|
35
|
+
switch (connector.ecosystem) {
|
|
36
|
+
case "solana":
|
|
37
|
+
return (0, import_solanaMessage.solanaMessageClient)(adapter, options.solanaChain);
|
|
38
|
+
case "sui":
|
|
39
|
+
return (0, import_sui.suiClient)(adapter);
|
|
40
|
+
case "bitcoin":
|
|
41
|
+
return (0, import_bitcoin.bitcoinClient)(adapter);
|
|
42
|
+
default:
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var connector_exports = {};
|
|
26
|
+
__export(connector_exports, {
|
|
27
|
+
clientForConnector: () => clientForConnector
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(connector_exports);
|
|
30
|
+
var import_adapter = require("./adapter.native.js");
|
|
31
|
+
var import_bitcoin = require("./bitcoin.native.js");
|
|
32
|
+
var import_solanaMessage = require("./solanaMessage.native.js");
|
|
33
|
+
var import_sui = require("./sui.native.js");
|
|
34
|
+
function clientForConnector(connector) {
|
|
35
|
+
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
36
|
+
var adapter = (0, import_adapter.connectorAdapter)(connector);
|
|
37
|
+
if (!(adapter === null || adapter === void 0 ? void 0 : adapter.address)) return null;
|
|
38
|
+
switch (connector.ecosystem) {
|
|
39
|
+
case "solana":
|
|
40
|
+
return (0, import_solanaMessage.solanaMessageClient)(adapter, options.solanaChain);
|
|
41
|
+
case "sui":
|
|
42
|
+
return (0, import_sui.suiClient)(adapter);
|
|
43
|
+
case "bitcoin":
|
|
44
|
+
return (0, import_bitcoin.bitcoinClient)(adapter);
|
|
45
|
+
default:
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=connector.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","connector_exports","__export","clientForConnector","module","exports","import_adapter","require","import_bitcoin","import_solanaMessage","import_sui","connector","options","arguments","length","adapter","connectorAdapter","address","ecosystem","solanaMessageClient","solanaChain","suiClient","bitcoinClient"],"sources":["../../../src/clients/connector.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,iBAAA;AAAAC,QAAA,CAAAD,iBAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAA;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAT,YAAiC,CAAAK,iBAAA;AACjC,IAAAK,cAAA,GAAkDC,OAAA;AAClD,IAAAC,cAAA,GAAAD,OAAgF;AAChF,IAAAE,oBAA0C,GAAAF,OAAA;AAenC,IAAAG,UAAS,GAAAH,OAAA,kBACd;AAGA,SAAMJ,kBAAUA,CAAAQ,SAAA;EAChB,IAAIC,OAAC,GAASC,SAAS,CAAAC,MAAO,QAAAD,SAAA,iBAAAA,SAAA;EAC9B,IAAAE,OAAS,OAAoCT,cAAW,CAAAU,gBAAA,EAAAL,SAAA;EAAA,IACtD,EAAAI,OAAK,aAAAA,OAAA,uBAAAA,OAAA,CAAAE,OAAA;EACH,QAAAN,SAAO,CAAAO,SAAA;IACT,KAAK;MACH,WAAOT,oBAAA,CAAAU,mBAAiB,EAAAJ,OAAA,EAAAH,OAAA,CAAAQ,WAAA;IAC1B,KAAK;MACH,WAAOV,UAAA,CAAAW,SAAA,EAAAN,OAAA,CAAc;IACvB;MACE,OAAO,IAAAP,cAAA,CAAAc,aAAA,EAAAP,OAAA;IACX;MACF","ignoreList":[]}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var evm_exports = {};
|
|
24
|
+
__export(evm_exports, {
|
|
25
|
+
evmClient: () => evmClient
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(evm_exports);
|
|
28
|
+
var import_viem = require("viem");
|
|
29
|
+
const erc20WriteAbi = [{
|
|
30
|
+
type: "function",
|
|
31
|
+
name: "transfer",
|
|
32
|
+
stateMutability: "nonpayable",
|
|
33
|
+
inputs: [{
|
|
34
|
+
name: "to",
|
|
35
|
+
type: "address"
|
|
36
|
+
}, {
|
|
37
|
+
name: "amount",
|
|
38
|
+
type: "uint256"
|
|
39
|
+
}],
|
|
40
|
+
outputs: []
|
|
41
|
+
}, {
|
|
42
|
+
type: "function",
|
|
43
|
+
name: "approve",
|
|
44
|
+
stateMutability: "nonpayable",
|
|
45
|
+
inputs: [{
|
|
46
|
+
name: "spender",
|
|
47
|
+
type: "address"
|
|
48
|
+
}, {
|
|
49
|
+
name: "amount",
|
|
50
|
+
type: "uint256"
|
|
51
|
+
}],
|
|
52
|
+
outputs: []
|
|
53
|
+
}];
|
|
54
|
+
const capabilities = ["signMessage", "sendTransaction", "writeContract"];
|
|
55
|
+
function evmClient(config) {
|
|
56
|
+
const walletClient = "walletClient" in config ? config.walletClient : (0, import_viem.createWalletClient)({
|
|
57
|
+
account: config.account,
|
|
58
|
+
chain: config.chain,
|
|
59
|
+
transport: (0, import_viem.custom)(config.provider)
|
|
60
|
+
});
|
|
61
|
+
const chain = walletClient.chain;
|
|
62
|
+
if (!chain) throw new Error("evmClient: the wallet client has no chain");
|
|
63
|
+
const publicClient = config.publicClient ?? (0, import_viem.createPublicClient)({
|
|
64
|
+
chain,
|
|
65
|
+
transport: (0, import_viem.http)(config.rpcUrl)
|
|
66
|
+
});
|
|
67
|
+
const account = walletClient.account;
|
|
68
|
+
const writeContract = parameters => walletClient.writeContract({
|
|
69
|
+
account,
|
|
70
|
+
chain,
|
|
71
|
+
...parameters
|
|
72
|
+
});
|
|
73
|
+
const simulateAndWrite = async parameters => {
|
|
74
|
+
const {
|
|
75
|
+
request
|
|
76
|
+
} = await publicClient.simulateContract({
|
|
77
|
+
account,
|
|
78
|
+
address: parameters.address,
|
|
79
|
+
abi: erc20WriteAbi,
|
|
80
|
+
functionName: parameters.functionName,
|
|
81
|
+
args: parameters.args
|
|
82
|
+
});
|
|
83
|
+
return walletClient.writeContract({
|
|
84
|
+
...request,
|
|
85
|
+
account,
|
|
86
|
+
chain
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
const approveAndWait = async (token, spender, amount) => {
|
|
90
|
+
const hash = await erc20.approve({
|
|
91
|
+
token,
|
|
92
|
+
spender,
|
|
93
|
+
amount
|
|
94
|
+
});
|
|
95
|
+
const receipt = await publicClient.waitForTransactionReceipt({
|
|
96
|
+
hash
|
|
97
|
+
});
|
|
98
|
+
if (receipt.status !== "success") throw new Error(`approve ${hash} reverted`);
|
|
99
|
+
return hash;
|
|
100
|
+
};
|
|
101
|
+
const erc20 = {
|
|
102
|
+
balanceOf: (token, owner = account.address) => publicClient.readContract({
|
|
103
|
+
address: token,
|
|
104
|
+
abi: import_viem.erc20Abi,
|
|
105
|
+
functionName: "balanceOf",
|
|
106
|
+
args: [owner]
|
|
107
|
+
}),
|
|
108
|
+
allowance: (token, spender, owner = account.address) => publicClient.readContract({
|
|
109
|
+
address: token,
|
|
110
|
+
abi: import_viem.erc20Abi,
|
|
111
|
+
functionName: "allowance",
|
|
112
|
+
args: [owner, spender]
|
|
113
|
+
}),
|
|
114
|
+
decimals: token => publicClient.readContract({
|
|
115
|
+
address: token,
|
|
116
|
+
abi: import_viem.erc20Abi,
|
|
117
|
+
functionName: "decimals"
|
|
118
|
+
}),
|
|
119
|
+
transfer: ({
|
|
120
|
+
token,
|
|
121
|
+
to,
|
|
122
|
+
amount
|
|
123
|
+
}) => simulateAndWrite({
|
|
124
|
+
address: token,
|
|
125
|
+
functionName: "transfer",
|
|
126
|
+
args: [to, amount]
|
|
127
|
+
}),
|
|
128
|
+
approve: ({
|
|
129
|
+
token,
|
|
130
|
+
spender,
|
|
131
|
+
amount
|
|
132
|
+
}) => simulateAndWrite({
|
|
133
|
+
address: token,
|
|
134
|
+
functionName: "approve",
|
|
135
|
+
args: [spender, amount]
|
|
136
|
+
}),
|
|
137
|
+
async ensureAllowance({
|
|
138
|
+
token,
|
|
139
|
+
spender,
|
|
140
|
+
amount
|
|
141
|
+
}) {
|
|
142
|
+
const current = await erc20.allowance(token, spender);
|
|
143
|
+
if (current >= amount) return null;
|
|
144
|
+
if (current > 0n) await approveAndWait(token, spender, 0n);
|
|
145
|
+
return approveAndWait(token, spender, amount);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
return {
|
|
149
|
+
family: "evm",
|
|
150
|
+
address: account.address,
|
|
151
|
+
chainId: chain.id,
|
|
152
|
+
chain,
|
|
153
|
+
capabilities,
|
|
154
|
+
walletClient,
|
|
155
|
+
publicClient,
|
|
156
|
+
signMessage: message => walletClient.signMessage({
|
|
157
|
+
account,
|
|
158
|
+
message
|
|
159
|
+
}),
|
|
160
|
+
sendTransaction: parameters => walletClient.sendTransaction({
|
|
161
|
+
account,
|
|
162
|
+
chain,
|
|
163
|
+
...parameters
|
|
164
|
+
}),
|
|
165
|
+
writeContract,
|
|
166
|
+
waitForTransactionReceipt: hash => publicClient.waitForTransactionReceipt({
|
|
167
|
+
hash
|
|
168
|
+
}),
|
|
169
|
+
erc20
|
|
170
|
+
};
|
|
171
|
+
}
|