@w3ux/react-connect-kit 1.6.0 → 1.8.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/ExtensionAccountsProvider/index.d.ts +0 -1
- package/ExtensionAccountsProvider/snap.js.map +1 -1
- package/ExtensionAccountsProvider/types.d.ts +1 -0
- package/ExtensionAccountsProvider/types.js.map +1 -1
- package/LedgerAccountsProvider/index.d.ts +0 -1
- package/VaultAccountsProvider/index.d.ts +0 -1
- package/WCAccountsProvider/index.d.ts +0 -1
- package/package.json +3 -4
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ExtensionAccountsContextInterface, ExtensionAccountsProviderProps } from "./types";
|
|
3
2
|
export declare const ExtensionAccountsContext: import("react").Context<ExtensionAccountsContextInterface>;
|
|
4
3
|
export declare const useExtensionAccounts: () => ExtensionAccountsContextInterface;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ExtensionAccountsProvider/snap.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,WAAW,EACX,wBAAwB,GACzB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAc1E,MAAM,iBAAiB,GAAG,CAAC,QAAkB,EAAsB,EAAE,CACnE,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;IAChC,OAAO;IACP,IAAI,EAAE,iBAAiB,KAAK,GAAG,CAAC,EAAE;IAClC,MAAM,EAAE,wBAAwB;IAChC,IAAI,EAAE,UAAU;CACjB,CAAC,CAAC,CAAC;AAEN,MAAM,kBAAkB,GAAG,CAAC,GAAe,EAAE,MAAkB,EAAQ,EAAE;IACvE,GAAG,CAAC,YAAY,CAAC,IAAI,GAAG;QACtB,MAAM,EAAE,KAAK,IAAuB,EAAE;YACpC,MAAM,IAAI,GAAG,CAAC,MAAM,kB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,GAAG,EAAE,MAAM,CAAC,CAAC;gBAGhC,MAAM,CAAC,YAAY,CAAC,wBAAwB,CAAC;oBAC3C,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;gBAC9B,OAAO,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;gBACnC,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;AACH,CAAC,CAAC,CAAC","file":"snap.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\nimport type {\n Injected,\n InjectedAccount,\n InjectedWindow,\n} from \"@polkadot/extension-inject/types\";\nimport {\n hasMetaMask,\n isMetamaskSnapsSupported,\n} from \"@chainsafe/metamask-polkadot-adapter/src/utils\";\nimport { enablePolkadotSnap } from \"@chainsafe/metamask-polkadot-adapter\";\nimport type {\n SignerPayloadJSON,\n SignerPayloadRaw,\n SignerResult,\n} from \"@polkadot/types/types\";\nimport
|
|
1
|
+
{"version":3,"sources":["../src/ExtensionAccountsProvider/snap.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,WAAW,EACX,wBAAwB,GACzB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAc1E,MAAM,iBAAiB,GAAG,CAAC,QAAkB,EAAsB,EAAE,CACnE,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;IAChC,OAAO;IACP,IAAI,EAAE,iBAAiB,KAAK,GAAG,CAAC,EAAE;IAClC,MAAM,EAAE,wBAAwB;IAChC,IAAI,EAAE,UAAU;CACjB,CAAC,CAAC,CAAC;AAEN,MAAM,kBAAkB,GAAG,CAAC,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;IAG1C,IAAI,WAAW,EAAE,EAAE,CAAC;QAClB,wBAAwB,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;YACzC,IAAI,MAAM,EAAE,CAAC;gBACX,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;gBAGhC,MAAM,CAAC,YAAY,CAAC,wBAAwB,CAAC;oBAC3C,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;gBAC9B,OAAO,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;gBACnC,OAAO,CAAC,IAAI,CAAC,CAAC;YAChB,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;AACH,CAAC,CAAC,CAAC","file":"snap.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\nimport type {\n Injected,\n InjectedAccount,\n InjectedWindow,\n} from \"@polkadot/extension-inject/types\";\nimport {\n hasMetaMask,\n isMetamaskSnapsSupported,\n} from \"@chainsafe/metamask-polkadot-adapter/src/utils\";\nimport { enablePolkadotSnap } from \"@chainsafe/metamask-polkadot-adapter\";\nimport type {\n SignerPayloadJSON,\n SignerPayloadRaw,\n SignerResult,\n} from \"@polkadot/types/types\";\nimport { SnapConfig } from \"@chainsafe/metamask-polkadot-types\";\nimport { ExtensionAccount } from \"../ExtensionsProvider/types\";\nimport { HexString } from \"types\";\n\ninterface Web3Window extends InjectedWindow {\n ethereum: unknown;\n}\n\nconst transformAccounts = (accounts: string[]): ExtensionAccount[] =>\n accounts.map((address, index) => ({\n address,\n name: `Polkadot Snap ${index + 1}`,\n source: \"metamask-polkadot-snap\",\n type: \"ethereum\",\n }));\n\nconst injectPolkadotSnap = (win: Web3Window, config: SnapConfig): void => {\n win.injectedWeb3.Snap = {\n enable: async (): Promise<Injected> => {\n const snap = (await enablePolkadotSnap(config)).getMetamaskSnapApi();\n\n return {\n accounts: {\n get: async (): Promise<InjectedAccount[]> => {\n const response = await snap.getAddress();\n return transformAccounts([response]);\n },\n // Currently there is only available only one account, in that case this method will never return anything.\n subscribe:\n (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars\n _cb: (accounts: InjectedAccount[]) => void\n ): (() => void) =>\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n (): void => {},\n },\n signer: {\n signPayload: async (\n payload: SignerPayloadJSON\n ): Promise<SignerResult> => {\n const signature = (await snap.signPayloadJSON(\n payload\n )) as HexString;\n return { id: 0, signature };\n },\n signRaw: async (raw: SignerPayloadRaw): Promise<SignerResult> => {\n const signature = (await snap.signPayloadRaw(raw)) as HexString;\n return { id: 0, signature };\n },\n },\n };\n },\n version: \"0.1\",\n };\n};\n\n// Initiate Polkadot snap and inject it into `injectedWeb3`. as `metamask-polkadot-snap`.\nexport const initPolkadotSnap = (config: SnapConfig): Promise<boolean> =>\n new Promise((resolve): void => {\n const win = window as Window & Web3Window;\n win.injectedWeb3 = win.injectedWeb3 || {};\n\n // Attempt to inject into `injectedWeb3`.\n if (hasMetaMask()) {\n isMetamaskSnapsSupported().then((result) => {\n if (result) {\n injectPolkadotSnap(win, config);\n // Overwrite `injectedWeb3` key with correct id and delete stale version.\n // Issue at: https://github.com/ChainSafe/metamask-snap-polkadot/issues/204\n window.injectedWeb3[\"metamask-polkadot-snap\"] =\n window.injectedWeb3[\"Snap\"];\n delete window.injectedWeb3[\"Snap\"];\n resolve(true);\n } else {\n resolve(false);\n }\n });\n } else {\n resolve(false);\n }\n });\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ExtensionAccountsProvider/types.ts"],"names":[],"mappings":"","file":"types.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\n\nimport { ReactNode } from \"react\";\nimport { ExtensionAccount } from \"../ExtensionsProvider/types\";\nimport { ImportedAccount, MaybeAddress } from \"../types\";\nimport { Sync } from \"@w3ux/types\";\n\nexport interface ExtensionAccountsContextInterface {\n connectExtensionAccounts: (id?: string) => Promise<boolean>;\n extensionAccountsSynced: Sync;\n getExtensionAccounts: (ss58: number) => ImportedAccount[];\n}\n\nexport interface ExtensionAccountsProviderProps {\n children: ReactNode;\n network: string;\n dappName: string;\n activeAccount?: MaybeAddress;\n setActiveAccount?: (address: MaybeAddress) => void;\n onExtensionEnabled?: (id: string) => void;\n}\n\nexport interface HandleImportExtension {\n newAccounts: ExtensionAccount[];\n meta: {\n accountsToRemove: ExtensionAccount[];\n removedActiveAccount: MaybeAddress;\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/ExtensionAccountsProvider/types.ts"],"names":[],"mappings":"","file":"types.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\n\nimport { ReactNode } from \"react\";\nimport { ExtensionAccount } from \"../ExtensionsProvider/types\";\nimport { ImportedAccount, MaybeAddress } from \"../types\";\nimport { Sync } from \"@w3ux/types\";\n\nexport interface ExtensionAccountsContextInterface {\n connectExtensionAccounts: (id?: string) => Promise<boolean>;\n extensionAccountsSynced: Sync;\n getExtensionAccounts: (ss58: number) => ImportedAccount[];\n}\n\nexport interface ExtensionAccountsProviderProps {\n children: ReactNode;\n network: string;\n dappName: string;\n activeAccount?: MaybeAddress;\n setActiveAccount?: (address: MaybeAddress) => void;\n onExtensionEnabled?: (id: string) => void;\n}\n\nexport interface HandleImportExtension {\n newAccounts: ExtensionAccount[];\n meta: {\n accountsToRemove: ExtensionAccount[];\n removedActiveAccount: MaybeAddress;\n };\n}\n\nexport type HexString = `0x${string}`;\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { LedgerAccountsContextInterface, LedgerAccountsProviderProps } from "./types";
|
|
3
2
|
export declare const LedgerAccountsContext: import("react").Context<LedgerAccountsContextInterface>;
|
|
4
3
|
export declare const useLedgerAccounts: () => LedgerAccountsContextInterface;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { VaultAccountsContextInterface, VaultAccountsProviderProps } from "./types";
|
|
3
2
|
export declare const VaultAccountsContext: import("react").Context<VaultAccountsContextInterface>;
|
|
4
3
|
export declare const useVaultAccounts: () => VaultAccountsContextInterface;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { WCAccountsContextInterface, WCAccountsProviderProps } from "./types";
|
|
3
2
|
export declare const WCAccountsContext: import("react").Context<WCAccountsContextInterface>;
|
|
4
3
|
export declare const useWcAccounts: () => WCAccountsContextInterface;
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@w3ux/react-connect-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"license": "GPL-3.0-only",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@chainsafe/metamask-polkadot-adapter": "^0.6.0",
|
|
7
|
-
"@polkadot/util": "^13.1.1",
|
|
8
7
|
"@polkagate/extension-dapp": "^0.46.13",
|
|
9
|
-
"@w3ux/extension-assets": "
|
|
8
|
+
"@w3ux/extension-assets": "0.4.0",
|
|
10
9
|
"@w3ux/hooks": "^1.1.0",
|
|
11
|
-
"@w3ux/utils": "^0.
|
|
10
|
+
"@w3ux/utils": "^0.9.0"
|
|
12
11
|
},
|
|
13
12
|
"type": "module",
|
|
14
13
|
"peerDependencies": {
|