@reef-knot/wallet-adapter-coinbase-smart-wallet 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/icons/coinbase.svg.js +59 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/package.json +44 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
|
|
4
|
+
var _circle, _path, _rect, _defs;
|
|
5
|
+
function _extends() {
|
|
6
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
7
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
8
|
+
var source = arguments[i];
|
|
9
|
+
for (var key in source) {
|
|
10
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
11
|
+
target[key] = source[key];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return target;
|
|
16
|
+
};
|
|
17
|
+
return _extends.apply(this, arguments);
|
|
18
|
+
}
|
|
19
|
+
var SvgCoinbase = function SvgCoinbase(props) {
|
|
20
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
21
|
+
width: 40,
|
|
22
|
+
height: 40,
|
|
23
|
+
viewBox: "0 0 40 40",
|
|
24
|
+
fill: "none",
|
|
25
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
26
|
+
}, props), _circle || (_circle = /*#__PURE__*/React.createElement("circle", {
|
|
27
|
+
cx: 20,
|
|
28
|
+
cy: 20,
|
|
29
|
+
r: 15,
|
|
30
|
+
fill: "#fff"
|
|
31
|
+
})), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
32
|
+
fillRule: "evenodd",
|
|
33
|
+
clipRule: "evenodd",
|
|
34
|
+
d: "M20 40c11.046 0 20-8.954 20-20S31.046 0 20 0 0 8.954 0 20s8.954 20 20 20zm0-8c6.627 0 12-5.373 12-12S26.627 8 20 8 8 13.373 8 20s5.373 12 12 12z",
|
|
35
|
+
fill: "url(#a)"
|
|
36
|
+
})), _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
|
|
37
|
+
x: 16,
|
|
38
|
+
y: 16,
|
|
39
|
+
width: 8,
|
|
40
|
+
height: 8,
|
|
41
|
+
rx: 1,
|
|
42
|
+
fill: "#2952EA"
|
|
43
|
+
})), _defs || (_defs = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
44
|
+
id: "a",
|
|
45
|
+
x1: 20,
|
|
46
|
+
y1: 0,
|
|
47
|
+
x2: 20,
|
|
48
|
+
y2: 40,
|
|
49
|
+
gradientUnits: "userSpaceOnUse"
|
|
50
|
+
}, /*#__PURE__*/React.createElement("stop", {
|
|
51
|
+
stopColor: "#345FF8"
|
|
52
|
+
}), /*#__PURE__*/React.createElement("stop", {
|
|
53
|
+
offset: 1,
|
|
54
|
+
stopColor: "#1D44DC"
|
|
55
|
+
})))));
|
|
56
|
+
};
|
|
57
|
+
var Memo = /*#__PURE__*/memo(SvgCoinbase);
|
|
58
|
+
|
|
59
|
+
export { Memo as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/icons/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { WalletAdapterType } from '@reef-knot/types';
|
|
2
|
+
import { coinbaseWallet } from 'wagmi/connectors';
|
|
3
|
+
export declare const id = "coinbaseSmartWallet";
|
|
4
|
+
export declare const name = "Coinbase Smart Wallet";
|
|
5
|
+
export declare const rdns = "com.coinbase.wallet";
|
|
6
|
+
type ConfigType = Parameters<ReturnType<typeof coinbaseWallet>>[0];
|
|
7
|
+
export declare const getCoinbaseSmartWalletConnector: (config: ConfigType) => {
|
|
8
|
+
name: string;
|
|
9
|
+
icon?: string | undefined;
|
|
10
|
+
id: string;
|
|
11
|
+
supportsSimulation?: boolean | undefined;
|
|
12
|
+
type: string;
|
|
13
|
+
setup?: (() => Promise<void>) | undefined;
|
|
14
|
+
connect: (parameters?: {
|
|
15
|
+
chainId?: number | undefined;
|
|
16
|
+
isReconnecting?: boolean | undefined;
|
|
17
|
+
} | undefined) => Promise<{
|
|
18
|
+
accounts: readonly `0x${string}`[];
|
|
19
|
+
chainId: number;
|
|
20
|
+
}>;
|
|
21
|
+
disconnect: () => Promise<void>;
|
|
22
|
+
getAccounts: () => Promise<readonly `0x${string}`[]>;
|
|
23
|
+
getChainId: () => Promise<number>;
|
|
24
|
+
getProvider: (parameters?: {
|
|
25
|
+
chainId?: number | undefined;
|
|
26
|
+
} | undefined) => Promise<import("cbw-sdk").CoinbaseWalletProvider>;
|
|
27
|
+
getClient?: ((parameters?: {
|
|
28
|
+
chainId?: number | undefined;
|
|
29
|
+
} | undefined) => Promise<import("viem").Client>) | undefined;
|
|
30
|
+
isAuthorized: () => Promise<boolean>;
|
|
31
|
+
switchChain?: ((parameters: {
|
|
32
|
+
addEthereumChainParameter?: import("@wagmi/core/internal").ExactPartial<import("@wagmi/core/internal").Omit<import("viem").AddEthereumChainParameter, "chainId">> | undefined;
|
|
33
|
+
chainId: number;
|
|
34
|
+
}) => Promise<import("viem").Chain>) | undefined;
|
|
35
|
+
onAccountsChanged: (accounts: string[]) => void;
|
|
36
|
+
onChainChanged: (chainId: string) => void;
|
|
37
|
+
onConnect?: ((connectInfo: import("viem").ProviderConnectInfo) => void) | undefined;
|
|
38
|
+
onDisconnect: (error?: Error | undefined) => void;
|
|
39
|
+
onMessage?: ((message: import("viem").ProviderMessage) => void) | undefined;
|
|
40
|
+
} | {
|
|
41
|
+
name: string;
|
|
42
|
+
icon?: string | undefined;
|
|
43
|
+
id: string;
|
|
44
|
+
supportsSimulation?: boolean | undefined;
|
|
45
|
+
type: string;
|
|
46
|
+
setup?: (() => Promise<void>) | undefined;
|
|
47
|
+
connect: (parameters?: {
|
|
48
|
+
chainId?: number | undefined;
|
|
49
|
+
isReconnecting?: boolean | undefined;
|
|
50
|
+
} | undefined) => Promise<{
|
|
51
|
+
accounts: readonly `0x${string}`[];
|
|
52
|
+
chainId: number;
|
|
53
|
+
}>;
|
|
54
|
+
disconnect: () => Promise<void>;
|
|
55
|
+
getAccounts: () => Promise<readonly `0x${string}`[]>;
|
|
56
|
+
getChainId: () => Promise<number>;
|
|
57
|
+
getProvider: (parameters?: {
|
|
58
|
+
chainId?: number | undefined;
|
|
59
|
+
} | undefined) => Promise<import("@coinbase/wallet-sdk").ProviderInterface & {
|
|
60
|
+
close?(): void;
|
|
61
|
+
}>;
|
|
62
|
+
getClient?: ((parameters?: {
|
|
63
|
+
chainId?: number | undefined;
|
|
64
|
+
} | undefined) => Promise<import("viem").Client>) | undefined;
|
|
65
|
+
isAuthorized: () => Promise<boolean>;
|
|
66
|
+
switchChain?: ((parameters: {
|
|
67
|
+
addEthereumChainParameter?: import("@wagmi/core/internal").ExactPartial<import("@wagmi/core/internal").Omit<import("viem").AddEthereumChainParameter, "chainId">> | undefined;
|
|
68
|
+
chainId: number;
|
|
69
|
+
}) => Promise<import("viem").Chain>) | undefined;
|
|
70
|
+
onAccountsChanged: (accounts: string[]) => void;
|
|
71
|
+
onChainChanged: (chainId: string) => void;
|
|
72
|
+
onConnect?: ((connectInfo: import("viem").ProviderConnectInfo) => void) | undefined;
|
|
73
|
+
onDisconnect: (error?: Error | undefined) => void;
|
|
74
|
+
onMessage?: ((message: import("viem").ProviderMessage) => void) | undefined;
|
|
75
|
+
};
|
|
76
|
+
export declare const CoinbaseSmartWallet: WalletAdapterType;
|
|
77
|
+
export {};
|
|
78
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD,eAAO,MAAM,EAAE,wBAAwB,CAAC;AACxC,eAAO,MAAM,IAAI,0BAA0B,CAAC;AAC5C,eAAO,MAAM,IAAI,wBAAwB,CAAC;AAE1C,KAAK,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnE,eAAO,MAAM,+BAA+B,WAAY,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYjE,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,iBAOhC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { coinbaseWallet } from 'wagmi/connectors';
|
|
2
|
+
import { isProviderExistsEIP6963 } from '@reef-knot/wallets-helpers';
|
|
3
|
+
import Memo from './icons/coinbase.svg.js';
|
|
4
|
+
|
|
5
|
+
const id = 'coinbaseSmartWallet';
|
|
6
|
+
const name = 'Coinbase Smart Wallet';
|
|
7
|
+
const rdns = 'com.coinbase.wallet';
|
|
8
|
+
const getCoinbaseSmartWalletConnector = config => {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
const coinbaseCreateConnectorFn = coinbaseWallet({
|
|
11
|
+
preference: 'smartWalletOnly',
|
|
12
|
+
appName: (_b = (_a = globalThis.window) === null || _a === void 0 ? void 0 : _a.location) === null || _b === void 0 ? void 0 : _b.hostname
|
|
13
|
+
});
|
|
14
|
+
const coinbaseConnector = coinbaseCreateConnectorFn(config);
|
|
15
|
+
return Object.assign(Object.assign({}, coinbaseConnector), {
|
|
16
|
+
name
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
const CoinbaseSmartWallet = ({
|
|
20
|
+
providersStore
|
|
21
|
+
}) => ({
|
|
22
|
+
walletName: name,
|
|
23
|
+
walletId: id,
|
|
24
|
+
type: coinbaseWallet.type,
|
|
25
|
+
icon: Memo,
|
|
26
|
+
detector: () => isProviderExistsEIP6963(providersStore, rdns),
|
|
27
|
+
createConnectorFn: getCoinbaseSmartWalletConnector
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export { CoinbaseSmartWallet, getCoinbaseSmartWalletConnector, id, name, rdns };
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@reef-knot/wallet-adapter-coinbase-smart-wallet",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"typesVersions": {
|
|
10
|
+
"*": {
|
|
11
|
+
".": [
|
|
12
|
+
"dist/index.d.ts"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"homepage": "https://github.com/lidofinance/reef-knot",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/lidofinance/reef-knot/issues"
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"registry": "https://registry.npmjs.org/",
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "rollup -c",
|
|
31
|
+
"dev": "dev=on rollup -c -w",
|
|
32
|
+
"lint": "eslint --ext ts,tsx,js,mjs ."
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@reef-knot/types": "^2.0.0",
|
|
36
|
+
"@svgr/rollup": "^6.5.1",
|
|
37
|
+
"eslint-config-custom": "*"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"wagmi": "2.10.4",
|
|
41
|
+
"@reef-knot/types": "^2.0.0",
|
|
42
|
+
"@tanstack/react-query": "^5.29.0"
|
|
43
|
+
}
|
|
44
|
+
}
|