@rango-dev/provider-rabby 0.1.1-next.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/CHANGELOG.md +0 -0
- package/dist/helpers.d.ts +2 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +7 -0
- package/dist/provider-rabby.build.json +1 -0
- package/dist/signer.d.ts +3 -0
- package/dist/signer.d.ts.map +1 -0
- package/package.json +31 -0
- package/readme.md +1 -0
- package/src/helpers.ts +5 -0
- package/src/index.ts +69 -0
- package/src/signer.ts +10 -0
package/CHANGELOG.md
ADDED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,QAIpB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CanEagerConnect, CanSwitchNetwork, Connect, Subscribe, SwitchNetwork, WalletInfo } from '@rango-dev/wallets-shared';
|
|
2
|
+
import type { BlockchainMeta, SignerFactory } from 'rango-types';
|
|
3
|
+
import { WalletTypes } from '@rango-dev/wallets-shared';
|
|
4
|
+
import { rabby as rabby_instance } from './helpers';
|
|
5
|
+
export declare const config: {
|
|
6
|
+
type: WalletTypes;
|
|
7
|
+
};
|
|
8
|
+
export declare const getInstance: typeof rabby_instance;
|
|
9
|
+
export declare const connect: Connect;
|
|
10
|
+
export declare const subscribe: Subscribe;
|
|
11
|
+
export declare const switchNetwork: SwitchNetwork;
|
|
12
|
+
export declare const canSwitchNetworkTo: CanSwitchNetwork;
|
|
13
|
+
export declare const getSigners: (provider: any) => SignerFactory;
|
|
14
|
+
export declare const canEagerConnect: CanEagerConnect;
|
|
15
|
+
export declare const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,SAAS,EACT,aAAa,EACb,UAAU,EACX,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAML,WAAW,EACZ,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,KAAK,IAAI,cAAc,EAAE,MAAM,WAAW,CAAC;AAGpD,eAAO,MAAM,MAAM;;CAElB,CAAC;AAEF,eAAO,MAAM,WAAW,uBAAiB,CAAC;AAC1C,eAAO,MAAM,OAAO,EAAE,OAarB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,SAA0B,CAAC;AAEnD,eAAO,MAAM,aAAa,EAAE,aAAmC,CAAC;AAEhE,eAAO,MAAM,kBAAkB,EAAE,gBAAwC,CAAC;AAE1E,eAAO,MAAM,UAAU,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,aAAsB,CAAC;AAEnE,eAAO,MAAM,eAAe,EAAE,eAAwC,CAAC;AAEvE,eAAO,MAAM,aAAa,EAAE,CAAC,cAAc,EAAE,cAAc,EAAE,KAAK,UAejE,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var c=Object.defineProperty;var o=(t,e)=>c(t,"name",{value:e,configurable:!0});import{canEagerlyConnectToEvm as p,canSwitchNetworkToEvm as l,getEvmAccounts as g,subscribeToEvm as b,switchNetworkForEvm as y,WalletTypes as w}from"@rango-dev/wallets-shared";import{evmBlockchains as h}from"rango-types";function n(){let{ethereum:t}=window;return t?.isRabby?t:null}o(n,"rabby");import{DefaultEvmSigner as i}from"@rango-dev/signer-evm";import{DefaultSignerFactory as s,TransactionType as m}from"rango-types";function r(t){let e=new s;return e.registerSigner(m.EVM,new i(t)),e}o(r,"getSigners");var F={type:w.Rabby},I=n,B=o(async({instance:t})=>{let{accounts:e,chainId:a}=await g(t);return{accounts:e,chainId:a}},"connect"),M=b,R=y,W=l,D=r,j=p,A=o(t=>{let e=h(t);return{name:"Rabby",img:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/rabby/icon.svg",installLink:{CHROME:"https://chromewebstore.google.com/detail/rabby-wallet/acmacodkjbdgmoleebolmdjonilkdbch",DEFAULT:"https://rabby.io/"},color:"#fff",supportedChains:e}},"getWalletInfo");export{j as canEagerConnect,W as canSwitchNetworkTo,F as config,B as connect,I as getInstance,D as getSigners,A as getWalletInfo,M as subscribe,R as switchNetwork};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts", "../src/helpers.ts", "../src/signer.ts"],
|
|
4
|
+
"sourcesContent": ["import type {\n CanEagerConnect,\n CanSwitchNetwork,\n Connect,\n Subscribe,\n SwitchNetwork,\n WalletInfo,\n} from '@rango-dev/wallets-shared';\nimport type { BlockchainMeta, SignerFactory } from 'rango-types';\n\nimport {\n canEagerlyConnectToEvm,\n canSwitchNetworkToEvm,\n getEvmAccounts,\n subscribeToEvm,\n switchNetworkForEvm,\n WalletTypes,\n} from '@rango-dev/wallets-shared';\nimport { evmBlockchains } from 'rango-types';\n\nimport { rabby as rabby_instance } from './helpers';\nimport signer from './signer';\n\nexport const config = {\n type: WalletTypes.Rabby,\n};\n\nexport const getInstance = rabby_instance;\nexport const connect: Connect = async ({ instance }) => {\n /*\n * Note: We need to get `chainId` here, because for the first time\n * after opening the browser, wallet is locked, and don't give us accounts and chainId\n * on `check` phase, so `network` will be null. For this case we need to get chainId\n * whenever we are requesting accounts.\n */\n const { accounts, chainId } = await getEvmAccounts(instance);\n\n return {\n accounts,\n chainId,\n };\n};\n\nexport const subscribe: Subscribe = subscribeToEvm;\n\nexport const switchNetwork: SwitchNetwork = switchNetworkForEvm;\n\nexport const canSwitchNetworkTo: CanSwitchNetwork = canSwitchNetworkToEvm;\n\nexport const getSigners: (provider: any) => SignerFactory = signer;\n\nexport const canEagerConnect: CanEagerConnect = canEagerlyConnectToEvm;\n\nexport const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (\n allBlockChains\n) => {\n const evms = evmBlockchains(allBlockChains);\n return {\n name: 'Rabby',\n img: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/rabby/icon.svg',\n installLink: {\n CHROME:\n 'https://chromewebstore.google.com/detail/rabby-wallet/acmacodkjbdgmoleebolmdjonilkdbch',\n DEFAULT: 'https://rabby.io/',\n },\n color: '#fff',\n supportedChains: evms,\n };\n};\n", "export function rabby() {\n const { ethereum } = window;\n\n return ethereum?.isRabby ? ethereum : null;\n}\n", "import type { SignerFactory } from 'rango-types';\n\nimport { DefaultEvmSigner } from '@rango-dev/signer-evm';\nimport { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default function getSigners(provider: any): SignerFactory {\n const signers = new DefaultSignerFactory();\n signers.registerSigner(TxType.EVM, new DefaultEvmSigner(provider));\n return signers;\n}\n"],
|
|
5
|
+
"mappings": "+EAUA,OACE,0BAAAA,EACA,yBAAAC,EACA,kBAAAC,EACA,kBAAAC,EACA,uBAAAC,EACA,eAAAC,MACK,4BACP,OAAS,kBAAAC,MAAsB,cClBxB,SAASC,GAAQ,CACtB,GAAM,CAAE,SAAAC,CAAS,EAAI,OAErB,OAAOA,GAAU,QAAUA,EAAW,IACxC,CAJgBC,EAAAF,EAAA,SCEhB,OAAS,oBAAAG,MAAwB,wBACjC,OAAS,wBAAAC,EAAsB,mBAAmBC,MAAc,cAEjD,SAARC,EAA4BC,EAA8B,CAC/D,IAAMC,EAAU,IAAIC,EACpB,OAAAD,EAAQ,eAAeE,EAAO,IAAK,IAAIC,EAAiBJ,CAAQ,CAAC,EAC1DC,CACT,CAJwBI,EAAAN,EAAA,cFkBjB,IAAMO,EAAS,CACpB,KAAMC,EAAY,KACpB,EAEaC,EAAcC,EACdC,EAAmBC,EAAA,MAAO,CAAE,SAAAC,CAAS,IAAM,CAOtD,GAAM,CAAE,SAAAC,EAAU,QAAAC,CAAQ,EAAI,MAAMC,EAAeH,CAAQ,EAE3D,MAAO,CACL,SAAAC,EACA,QAAAC,CACF,CACF,EAbgC,WAenBE,EAAuBC,EAEvBC,EAA+BC,EAE/BC,EAAuCC,EAEvCC,EAA+CA,EAE/CC,EAAmCC,EAEnCC,EAAkEd,EAC7Ee,GACG,CACH,IAAMC,EAAOC,EAAeF,CAAc,EAC1C,MAAO,CACL,KAAM,QACN,IAAK,sFACL,YAAa,CACX,OACE,yFACF,QAAS,mBACX,EACA,MAAO,OACP,gBAAiBC,CACnB,CACF,EAf+E",
|
|
6
|
+
"names": ["canEagerlyConnectToEvm", "canSwitchNetworkToEvm", "getEvmAccounts", "subscribeToEvm", "switchNetworkForEvm", "WalletTypes", "evmBlockchains", "rabby", "ethereum", "__name", "DefaultEvmSigner", "DefaultSignerFactory", "TxType", "getSigners", "provider", "signers", "DefaultSignerFactory", "TxType", "DefaultEvmSigner", "__name", "config", "WalletTypes", "getInstance", "rabby", "connect", "__name", "instance", "accounts", "chainId", "getEvmAccounts", "subscribe", "subscribeToEvm", "switchNetwork", "switchNetworkForEvm", "canSwitchNetworkTo", "canSwitchNetworkToEvm", "getSigners", "canEagerConnect", "canEagerlyConnectToEvm", "getWalletInfo", "allBlockChains", "evms", "evmBlockchains"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/helpers.ts":{"bytes":106,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signer.ts":{"bytes":392,"imports":[{"path":"@rango-dev/signer-evm","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":1922,"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"src/helpers.ts","kind":"import-statement","original":"./helpers"},{"path":"src/signer.ts","kind":"import-statement","original":"./signer"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":4195},"dist/index.js":{"imports":[{"path":"@rango-dev/wallets-shared","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"@rango-dev/signer-evm","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true}],"exports":["canEagerConnect","canSwitchNetworkTo","config","connect","getInstance","getSigners","getWalletInfo","subscribe","switchNetwork"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":687},"src/helpers.ts":{"bytesInOutput":74},"src/signer.ts":{"bytesInOutput":215}},"bytes":1254}}}
|
package/dist/signer.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,QAAQ,EAAE,GAAG,GAAG,aAAa,CAI/D"}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rango-dev/provider-rabby",
|
|
3
|
+
"version": "0.1.1-next.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"source": "./src/index.ts",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"typings": "dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"src"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "node ../../scripts/build/command.mjs --path wallets/provider-rabby",
|
|
18
|
+
"ts-check": "tsc --declaration --emitDeclarationOnly -p ./tsconfig.json",
|
|
19
|
+
"clean": "rimraf dist",
|
|
20
|
+
"format": "prettier --write '{.,src}/**/*.{ts,tsx}'",
|
|
21
|
+
"lint": "eslint \"**/*.{ts,tsx}\" --ignore-path ../../.eslintignore"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@rango-dev/signer-evm": "^0.27.2-next.0",
|
|
25
|
+
"@rango-dev/wallets-shared": "^0.34.1-next.2",
|
|
26
|
+
"rango-types": "^0.1.59"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @rango-dev/provider-rabby
|
package/src/helpers.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CanEagerConnect,
|
|
3
|
+
CanSwitchNetwork,
|
|
4
|
+
Connect,
|
|
5
|
+
Subscribe,
|
|
6
|
+
SwitchNetwork,
|
|
7
|
+
WalletInfo,
|
|
8
|
+
} from '@rango-dev/wallets-shared';
|
|
9
|
+
import type { BlockchainMeta, SignerFactory } from 'rango-types';
|
|
10
|
+
|
|
11
|
+
import {
|
|
12
|
+
canEagerlyConnectToEvm,
|
|
13
|
+
canSwitchNetworkToEvm,
|
|
14
|
+
getEvmAccounts,
|
|
15
|
+
subscribeToEvm,
|
|
16
|
+
switchNetworkForEvm,
|
|
17
|
+
WalletTypes,
|
|
18
|
+
} from '@rango-dev/wallets-shared';
|
|
19
|
+
import { evmBlockchains } from 'rango-types';
|
|
20
|
+
|
|
21
|
+
import { rabby as rabby_instance } from './helpers';
|
|
22
|
+
import signer from './signer';
|
|
23
|
+
|
|
24
|
+
export const config = {
|
|
25
|
+
type: WalletTypes.Rabby,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const getInstance = rabby_instance;
|
|
29
|
+
export const connect: Connect = async ({ instance }) => {
|
|
30
|
+
/*
|
|
31
|
+
* Note: We need to get `chainId` here, because for the first time
|
|
32
|
+
* after opening the browser, wallet is locked, and don't give us accounts and chainId
|
|
33
|
+
* on `check` phase, so `network` will be null. For this case we need to get chainId
|
|
34
|
+
* whenever we are requesting accounts.
|
|
35
|
+
*/
|
|
36
|
+
const { accounts, chainId } = await getEvmAccounts(instance);
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
accounts,
|
|
40
|
+
chainId,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const subscribe: Subscribe = subscribeToEvm;
|
|
45
|
+
|
|
46
|
+
export const switchNetwork: SwitchNetwork = switchNetworkForEvm;
|
|
47
|
+
|
|
48
|
+
export const canSwitchNetworkTo: CanSwitchNetwork = canSwitchNetworkToEvm;
|
|
49
|
+
|
|
50
|
+
export const getSigners: (provider: any) => SignerFactory = signer;
|
|
51
|
+
|
|
52
|
+
export const canEagerConnect: CanEagerConnect = canEagerlyConnectToEvm;
|
|
53
|
+
|
|
54
|
+
export const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (
|
|
55
|
+
allBlockChains
|
|
56
|
+
) => {
|
|
57
|
+
const evms = evmBlockchains(allBlockChains);
|
|
58
|
+
return {
|
|
59
|
+
name: 'Rabby',
|
|
60
|
+
img: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/rabby/icon.svg',
|
|
61
|
+
installLink: {
|
|
62
|
+
CHROME:
|
|
63
|
+
'https://chromewebstore.google.com/detail/rabby-wallet/acmacodkjbdgmoleebolmdjonilkdbch',
|
|
64
|
+
DEFAULT: 'https://rabby.io/',
|
|
65
|
+
},
|
|
66
|
+
color: '#fff',
|
|
67
|
+
supportedChains: evms,
|
|
68
|
+
};
|
|
69
|
+
};
|
package/src/signer.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SignerFactory } from 'rango-types';
|
|
2
|
+
|
|
3
|
+
import { DefaultEvmSigner } from '@rango-dev/signer-evm';
|
|
4
|
+
import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';
|
|
5
|
+
|
|
6
|
+
export default function getSigners(provider: any): SignerFactory {
|
|
7
|
+
const signers = new DefaultSignerFactory();
|
|
8
|
+
signers.registerSigner(TxType.EVM, new DefaultEvmSigner(provider));
|
|
9
|
+
return signers;
|
|
10
|
+
}
|