@rango-dev/provider-ready 0.49.1-next.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.
- package/CHANGELOG.md +199 -0
- package/dist/helpers.d.ts +3 -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-ready.build.json +1 -0
- package/dist/signer.d.ts +4 -0
- package/dist/signer.d.ts.map +1 -0
- package/package.json +31 -0
- package/readme.md +1 -0
- package/src/helpers.ts +9 -0
- package/src/index.ts +93 -0
- package/src/signer.ts +13 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# [0.50.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.49.0...provider-argentx@0.50.0) (2025-08-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# [0.49.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.48.0...provider-argentx@0.49.0) (2025-08-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# [0.48.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.47.0...provider-argentx@0.48.0) (2025-07-22)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Reverts
|
|
13
|
+
|
|
14
|
+
* Revert "chore(release): publish" ([064ce15](https://github.com/rango-exchange/rango-client/commit/064ce157a2f819856f647f83aeb1c0410542e8d7))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [0.46.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.45.1...provider-argentx@0.46.0) (2025-06-09)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [0.45.1](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.45.0...provider-argentx@0.45.1) (2025-05-04)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
# [0.45.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.44.0...provider-argentx@0.45.0) (2025-04-30)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* rename pbt to ptb for sui ([3d6d89f](https://github.com/rango-exchange/rango-client/commit/3d6d89f2265766607a15d61e0df92643fb33072b))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* update sui to consider recent api changes ([d764b25](https://github.com/rango-exchange/rango-client/commit/d764b2501df9bb295f63cdbc0b05acd4a3abb4b9))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# [0.44.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.43.0...provider-argentx@0.44.0) (2025-03-11)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
# [0.43.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.42.0...provider-argentx@0.43.0) (2025-02-23)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# [0.42.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.41.0...provider-argentx@0.42.0) (2024-12-30)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# [0.41.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.40.0...provider-argentx@0.41.0) (2024-11-27)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# [0.40.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.39.0...provider-argentx@0.40.0) (2024-11-12)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# [0.39.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.38.0...provider-argentx@0.39.0) (2024-10-12)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Bug Fixes
|
|
64
|
+
|
|
65
|
+
* bump sdk and fix type issues ([d442208](https://github.com/rango-exchange/rango-client/commit/d4422083bf5dd27d5f509ce1db7f9560d05428c8))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Performance Improvements
|
|
69
|
+
|
|
70
|
+
* lazy load signer packages ([7b88f18](https://github.com/rango-exchange/rango-client/commit/7b88f1834f7b29b4b81ab6c81a07bb88e8ccf55c))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
# [0.38.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.37.0...provider-argentx@0.38.0) (2024-09-10)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
# [0.37.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.36.1...provider-argentx@0.37.0) (2024-08-11)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
## [0.36.1](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.36.0...provider-argentx@0.36.1) (2024-07-14)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# [0.36.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.34.0...provider-argentx@0.36.0) (2024-07-09)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
# [0.35.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.34.0...provider-argentx@0.35.0) (2024-06-01)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# [0.34.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.33.0...provider-argentx@0.34.0) (2024-05-14)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
# [0.33.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.32.0...provider-argentx@0.33.0) (2024-04-24)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# [0.32.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.31.0...provider-argentx@0.32.0) (2024-04-23)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# [0.31.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.30.0...provider-argentx@0.31.0) (2024-04-09)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
### Bug Fixes
|
|
110
|
+
|
|
111
|
+
* fix the connection problem that happens when another wallet takes over the requested one ([42df212](https://github.com/rango-exchange/rango-client/commit/42df2120aadd84c95045b0bf76844c19305fb59a))
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
# [0.30.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.29.0...provider-argentx@0.30.0) (2024-03-12)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
# [0.29.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.28.0...provider-argentx@0.29.0) (2024-02-20)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# [0.28.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.27.0...provider-argentx@0.28.0) (2024-02-07)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
# [0.27.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.26.0...provider-argentx@0.27.0) (2024-01-22)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
### Bug Fixes
|
|
131
|
+
|
|
132
|
+
* cleanup wallets' subscriber when setProvider get null ([88d6a42](https://github.com/rango-exchange/rango-client/commit/88d6a423c49b34b3d9ff567e22df36c3b009bb76))
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
# [0.26.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.24.0...provider-argentx@0.26.0) (2023-12-24)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
### Bug Fixes
|
|
140
|
+
|
|
141
|
+
* fix HMR for widget and playground ([8524820](https://github.com/rango-exchange/rango-client/commit/8524820f10cf0b8921f3db0c4f620ff98daa4103))
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# [0.14.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.13.0...provider-argentx@0.14.0) (2023-08-03)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
# [0.13.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.12.0...provider-argentx@0.13.0) (2023-08-01)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
# [0.9.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.8.0...provider-argentx@0.9.0) (2023-07-31)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
### Features
|
|
157
|
+
|
|
158
|
+
* support braavos wallet ([fb38ebe](https://github.com/rango-exchange/rango-client/commit/fb38ebef00a33b92cabf506c88ef83d8c77cce84))
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
# [0.7.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.6.0...provider-argentx@0.7.0) (2023-07-11)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
# [0.6.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.5.0...provider-argentx@0.6.0) (2023-07-11)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
### Reverts
|
|
170
|
+
|
|
171
|
+
* Revert "support for rango-types cjs format" ([ed4e050](https://github.com/rango-exchange/rango-client/commit/ed4e050bfc0dcde7aeffa6b0d73b02080a5721eb))
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
# [0.5.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.4.0...provider-argentx@0.5.0) (2023-05-31)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
# [0.4.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.3.0...provider-argentx@0.4.0) (2023-05-31)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
# [0.3.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.2.0...provider-argentx@0.3.0) (2023-05-30)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
# [0.2.0](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.1.15...provider-argentx@0.2.0) (2023-05-30)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
## [0.1.14](https://github.com/rango-exchange/rango-client/compare/provider-argentx@0.1.13...provider-argentx@0.1.14) (2023-05-15)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
### Bug Fixes
|
|
195
|
+
|
|
196
|
+
* update rango-types and fix notification bugs ([993f185](https://github.com/rango-exchange/rango-client/commit/993f185e0b8c5e5e15a2c65ba2d85d1f9c8daa90))
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACtD,wBAAgB,KAAK,QAMpB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CanEagerConnect, CanSwitchNetwork, Connect, Subscribe, WalletInfo } from '@rango-dev/wallets-shared';
|
|
2
|
+
import type { BlockchainMeta, SignerFactory } from 'rango-types';
|
|
3
|
+
import { Networks, WalletTypes } from '@rango-dev/wallets-shared';
|
|
4
|
+
import { ready as readyInstances, type StarknetProviderAPI } from './helpers.js';
|
|
5
|
+
export declare const config: {
|
|
6
|
+
type: WalletTypes;
|
|
7
|
+
defaultNetwork: Networks;
|
|
8
|
+
};
|
|
9
|
+
export declare const getInstance: typeof readyInstances;
|
|
10
|
+
export declare const connect: Connect;
|
|
11
|
+
export declare const subscribe: Subscribe;
|
|
12
|
+
export declare const canSwitchNetworkTo: CanSwitchNetwork;
|
|
13
|
+
export declare const getSigners: (provider: StarknetProviderAPI) => Promise<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,UAAU,EACX,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EACL,KAAK,IAAI,cAAc,EACvB,KAAK,mBAAmB,EACzB,MAAM,cAAc,CAAC;AAatB,eAAO,MAAM,MAAM;;;CAGlB,CAAC;AAEF,eAAO,MAAM,WAAW,uBAAiB,CAAC;AAE1C,eAAO,MAAM,OAAO,EAAE,OAYrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,SAavB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,gBAA8B,CAAC;AAEhE,eAAO,MAAM,UAAU,EAAE,CACvB,QAAQ,EAAE,mBAAmB,KAC1B,OAAO,CAAC,aAAa,CAAU,CAAC;AAErC,eAAO,MAAM,eAAe,EAAE,eACF,CAAC;AAE7B,eAAO,MAAM,aAAa,EAAE,CAAC,cAAc,EAAE,cAAc,EAAE,KAAK,UAmBjE,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var l=Object.defineProperty;var r=(e,t)=>l(e,"name",{value:t,configurable:!0});import{Networks as n,WalletTypes as h}from"@rango-dev/wallets-shared";import{starknetBlockchain as m}from"rango-types";function i(){let{starknet_argentX:e}=window;return e||null}r(i,"ready");import{DefaultStarknetSigner as g}from"@rango-dev/signer-starknet";import{DefaultSignerFactory as p,TransactionType as d}from"rango-types";async function o(e){let t=new p;return t.registerSigner(d.STARKNET,new g(e)),t}r(o,"getSigners");var f=h.READY,y="SN_MAIN",N={type:f,defaultNetwork:n.STARKNET},P=i,R=r(async({instance:e})=>{let t;if(t=await e?.enable(),!t||!e.isConnected||t?.length===0)throw new Error("Error connecting Ready");if(e?.chainId!==y)throw new Error(`Please switch to Mainnet, current network is ${e?.chainId}`);return{accounts:t||[],chainId:n.STARKNET}},"connect"),v=r(({instance:e,state:t,updateAccounts:c})=>{let a=r(s=>{t.connected&&e&&c(s,n.STARKNET)},"handleAccountsChanged");return e?.on?.("accountsChanged",a),()=>{e?.off?.("accountsChanged",a)}},"subscribe"),F=r(()=>!1,"canSwitchNetworkTo"),B=o,M=r(({instance:e})=>e.isPreauthorized(),"canEagerConnect"),D=r(e=>{let t=m(e);return{name:"Ready",img:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/argentx/icon.svg",installLink:{CHROME:"https://chromewebstore.google.com/detail/ready-wallet-formerly-arg/dlcobpjiigpikoobohmabehhmhfoodbb",BRAVE:"https://chromewebstore.google.com/detail/ready-wallet-formerly-arg/dlcobpjiigpikoobohmabehhmhfoodbb",FIREFOX:"https://addons.mozilla.org/en-GB/firefox/addon/argent-x",DEFAULT:"https://www.ready.co/"},color:"#96e7ed",supportedChains:t}},"getWalletInfo");export{M as canEagerConnect,F as canSwitchNetworkTo,N as config,R as connect,P as getInstance,B as getSigners,D as getWalletInfo,v as subscribe};
|
|
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 WalletInfo,\n} from '@rango-dev/wallets-shared';\nimport type { BlockchainMeta, SignerFactory } from 'rango-types';\n\nimport { Networks, WalletTypes } from '@rango-dev/wallets-shared';\nimport { starknetBlockchain } from 'rango-types';\n\nimport {\n ready as readyInstances,\n type StarknetProviderAPI,\n} from './helpers.js';\nimport signer from './signer.js';\n\n/*\n * https://www.starknetjs.com/docs/API/signer\n * https://github.com/apibara/starknet-react\n * https://github.com/0xs34n/starknet.js\n * https://github.com/argentlabs/argent-x#-usage-with-your-dapp\n */\n\nconst WALLET = WalletTypes.READY;\nconst MAINNET_CHAIN_ID = 'SN_MAIN';\n\nexport const config = {\n type: WALLET,\n defaultNetwork: Networks.STARKNET,\n};\n\nexport const getInstance = readyInstances;\n\nexport const connect: Connect = async ({ instance }) => {\n let r = undefined;\n r = await instance?.enable();\n if (!r || !instance.isConnected || r?.length === 0) {\n throw new Error('Error connecting Ready');\n }\n if (instance?.chainId !== MAINNET_CHAIN_ID) {\n throw new Error(\n `Please switch to Mainnet, current network is ${instance?.chainId}`\n );\n }\n return { accounts: r ? r : [], chainId: Networks.STARKNET };\n};\n\nexport const subscribe: Subscribe = ({ instance, state, updateAccounts }) => {\n const handleAccountsChanged = (accounts: string[]) => {\n if (state.connected) {\n if (instance) {\n updateAccounts(accounts, Networks.STARKNET);\n }\n }\n };\n instance?.on?.('accountsChanged', handleAccountsChanged);\n\n return () => {\n instance?.off?.('accountsChanged', handleAccountsChanged);\n };\n};\n\nexport const canSwitchNetworkTo: CanSwitchNetwork = () => false;\n\nexport const getSigners: (\n provider: StarknetProviderAPI\n) => Promise<SignerFactory> = signer;\n\nexport const canEagerConnect: CanEagerConnect = ({ instance }) =>\n instance.isPreauthorized();\n\nexport const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (\n allBlockChains\n) => {\n const starknet = starknetBlockchain(allBlockChains);\n return {\n name: 'Ready',\n img: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/argentx/icon.svg',\n installLink: {\n CHROME:\n 'https://chromewebstore.google.com/detail/ready-wallet-formerly-arg/dlcobpjiigpikoobohmabehhmhfoodbb',\n BRAVE:\n 'https://chromewebstore.google.com/detail/ready-wallet-formerly-arg/dlcobpjiigpikoobohmabehhmhfoodbb',\n FIREFOX: 'https://addons.mozilla.org/en-GB/firefox/addon/argent-x',\n DEFAULT: 'https://www.ready.co/',\n },\n\n color: '#96e7ed',\n supportedChains: starknet,\n };\n};\n", "// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type StarknetProviderAPI = Record<string, any>;\nexport function ready() {\n const { starknet_argentX } = window;\n if (!!starknet_argentX) {\n return starknet_argentX;\n }\n return null;\n}\n", "import type { StarknetProviderAPI } from './helpers.js';\nimport type { SignerFactory } from 'rango-types';\n\nimport { DefaultStarknetSigner } from '@rango-dev/signer-starknet';\nimport { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';\n\nexport default async function getSigners(\n provider: StarknetProviderAPI\n): Promise<SignerFactory> {\n const signers = new DefaultSignerFactory();\n signers.registerSigner(TxType.STARKNET, new DefaultStarknetSigner(provider));\n return signers;\n}\n"],
|
|
5
|
+
"mappings": "+EASA,OAAS,YAAAA,EAAU,eAAAC,MAAmB,4BACtC,OAAS,sBAAAC,MAA0B,cCR5B,SAASC,GAAQ,CACtB,GAAM,CAAE,iBAAAC,CAAiB,EAAI,OAC7B,OAAMA,GAGC,IACT,CANgBC,EAAAF,EAAA,SCChB,OAAS,yBAAAG,MAA6B,6BACtC,OAAS,wBAAAC,EAAsB,mBAAmBC,MAAc,cAEhE,eAAOC,EACLC,EACwB,CACxB,IAAMC,EAAU,IAAIC,EACpB,OAAAD,EAAQ,eAAeE,EAAO,SAAU,IAAIC,EAAsBJ,CAAQ,CAAC,EACpEC,CACT,CAN8BI,EAAAN,EAAA,cFmB9B,IAAMO,EAASC,EAAY,MACrBC,EAAmB,UAEZC,EAAS,CACpB,KAAMH,EACN,eAAgBI,EAAS,QAC3B,EAEaC,EAAcC,EAEdC,EAAmBC,EAAA,MAAO,CAAE,SAAAC,CAAS,IAAM,CACtD,IAAIC,EAEJ,GADAA,EAAI,MAAMD,GAAU,OAAO,EACvB,CAACC,GAAK,CAACD,EAAS,aAAeC,GAAG,SAAW,EAC/C,MAAM,IAAI,MAAM,wBAAwB,EAE1C,GAAID,GAAU,UAAYP,EACxB,MAAM,IAAI,MACR,gDAAgDO,GAAU,OAAO,EACnE,EAEF,MAAO,CAAE,SAAUC,GAAQ,CAAC,EAAG,QAASN,EAAS,QAAS,CAC5D,EAZgC,WAcnBO,EAAuBH,EAAA,CAAC,CAAE,SAAAC,EAAU,MAAAG,EAAO,eAAAC,CAAe,IAAM,CAC3E,IAAMC,EAAwBN,EAACO,GAAuB,CAChDH,EAAM,WACJH,GACFI,EAAeE,EAAUX,EAAS,QAAQ,CAGhD,EAN8B,yBAO9B,OAAAK,GAAU,KAAK,kBAAmBK,CAAqB,EAEhD,IAAM,CACXL,GAAU,MAAM,kBAAmBK,CAAqB,CAC1D,CACF,EAboC,aAevBE,EAAuCR,EAAA,IAAM,GAAN,sBAEvCS,EAEiBA,EAEjBC,EAAmCV,EAAA,CAAC,CAAE,SAAAC,CAAS,IAC1DA,EAAS,gBAAgB,EADqB,mBAGnCU,EAAkEX,EAC7EY,GACG,CACH,IAAMC,EAAWC,EAAmBF,CAAc,EAClD,MAAO,CACL,KAAM,QACN,IAAK,wFACL,YAAa,CACX,OACE,sGACF,MACE,sGACF,QAAS,0DACT,QAAS,uBACX,EAEA,MAAO,UACP,gBAAiBC,CACnB,CACF,EAnB+E",
|
|
6
|
+
"names": ["Networks", "WalletTypes", "starknetBlockchain", "ready", "starknet_argentX", "__name", "DefaultStarknetSigner", "DefaultSignerFactory", "TxType", "getSigners", "provider", "signers", "DefaultSignerFactory", "TxType", "DefaultStarknetSigner", "__name", "WALLET", "WalletTypes", "MAINNET_CHAIN_ID", "config", "Networks", "getInstance", "ready", "connect", "__name", "instance", "r", "subscribe", "state", "updateAccounts", "handleAccountsChanged", "accounts", "canSwitchNetworkTo", "getSigners", "canEagerConnect", "getWalletInfo", "allBlockChains", "starknet", "starknetBlockchain"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/helpers.ts":{"bytes":261,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signer.ts":{"bytes":504,"imports":[{"path":"@rango-dev/signer-starknet","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":2681,"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.js"},{"path":"src/signer.ts","kind":"import-statement","original":"./signer.js"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":5582},"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-starknet","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true}],"exports":["canEagerConnect","canSwitchNetworkTo","config","connect","getInstance","getSigners","getWalletInfo","subscribe"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":1278},"src/helpers.ts":{"bytesInOutput":72},"src/signer.ts":{"bytesInOutput":236}},"bytes":1845}}}
|
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,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,wBAA8B,UAAU,CACtC,QAAQ,EAAE,mBAAmB,GAC5B,OAAO,CAAC,aAAa,CAAC,CAIxB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rango-dev/provider-ready",
|
|
3
|
+
"version": "0.49.1-next.1",
|
|
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-ready",
|
|
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}\""
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@rango-dev/signer-starknet": "^0.40.0",
|
|
25
|
+
"@rango-dev/wallets-shared": "^0.49.1-next.1",
|
|
26
|
+
"rango-types": "^0.1.89"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @rango-dev/provider-ready
|
package/src/helpers.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
|
+
export type StarknetProviderAPI = Record<string, any>;
|
|
3
|
+
export function ready() {
|
|
4
|
+
const { starknet_argentX } = window;
|
|
5
|
+
if (!!starknet_argentX) {
|
|
6
|
+
return starknet_argentX;
|
|
7
|
+
}
|
|
8
|
+
return null;
|
|
9
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CanEagerConnect,
|
|
3
|
+
CanSwitchNetwork,
|
|
4
|
+
Connect,
|
|
5
|
+
Subscribe,
|
|
6
|
+
WalletInfo,
|
|
7
|
+
} from '@rango-dev/wallets-shared';
|
|
8
|
+
import type { BlockchainMeta, SignerFactory } from 'rango-types';
|
|
9
|
+
|
|
10
|
+
import { Networks, WalletTypes } from '@rango-dev/wallets-shared';
|
|
11
|
+
import { starknetBlockchain } from 'rango-types';
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
ready as readyInstances,
|
|
15
|
+
type StarknetProviderAPI,
|
|
16
|
+
} from './helpers.js';
|
|
17
|
+
import signer from './signer.js';
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
* https://www.starknetjs.com/docs/API/signer
|
|
21
|
+
* https://github.com/apibara/starknet-react
|
|
22
|
+
* https://github.com/0xs34n/starknet.js
|
|
23
|
+
* https://github.com/argentlabs/argent-x#-usage-with-your-dapp
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const WALLET = WalletTypes.READY;
|
|
27
|
+
const MAINNET_CHAIN_ID = 'SN_MAIN';
|
|
28
|
+
|
|
29
|
+
export const config = {
|
|
30
|
+
type: WALLET,
|
|
31
|
+
defaultNetwork: Networks.STARKNET,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const getInstance = readyInstances;
|
|
35
|
+
|
|
36
|
+
export const connect: Connect = async ({ instance }) => {
|
|
37
|
+
let r = undefined;
|
|
38
|
+
r = await instance?.enable();
|
|
39
|
+
if (!r || !instance.isConnected || r?.length === 0) {
|
|
40
|
+
throw new Error('Error connecting Ready');
|
|
41
|
+
}
|
|
42
|
+
if (instance?.chainId !== MAINNET_CHAIN_ID) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
`Please switch to Mainnet, current network is ${instance?.chainId}`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
return { accounts: r ? r : [], chainId: Networks.STARKNET };
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const subscribe: Subscribe = ({ instance, state, updateAccounts }) => {
|
|
51
|
+
const handleAccountsChanged = (accounts: string[]) => {
|
|
52
|
+
if (state.connected) {
|
|
53
|
+
if (instance) {
|
|
54
|
+
updateAccounts(accounts, Networks.STARKNET);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
instance?.on?.('accountsChanged', handleAccountsChanged);
|
|
59
|
+
|
|
60
|
+
return () => {
|
|
61
|
+
instance?.off?.('accountsChanged', handleAccountsChanged);
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const canSwitchNetworkTo: CanSwitchNetwork = () => false;
|
|
66
|
+
|
|
67
|
+
export const getSigners: (
|
|
68
|
+
provider: StarknetProviderAPI
|
|
69
|
+
) => Promise<SignerFactory> = signer;
|
|
70
|
+
|
|
71
|
+
export const canEagerConnect: CanEagerConnect = ({ instance }) =>
|
|
72
|
+
instance.isPreauthorized();
|
|
73
|
+
|
|
74
|
+
export const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (
|
|
75
|
+
allBlockChains
|
|
76
|
+
) => {
|
|
77
|
+
const starknet = starknetBlockchain(allBlockChains);
|
|
78
|
+
return {
|
|
79
|
+
name: 'Ready',
|
|
80
|
+
img: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/argentx/icon.svg',
|
|
81
|
+
installLink: {
|
|
82
|
+
CHROME:
|
|
83
|
+
'https://chromewebstore.google.com/detail/ready-wallet-formerly-arg/dlcobpjiigpikoobohmabehhmhfoodbb',
|
|
84
|
+
BRAVE:
|
|
85
|
+
'https://chromewebstore.google.com/detail/ready-wallet-formerly-arg/dlcobpjiigpikoobohmabehhmhfoodbb',
|
|
86
|
+
FIREFOX: 'https://addons.mozilla.org/en-GB/firefox/addon/argent-x',
|
|
87
|
+
DEFAULT: 'https://www.ready.co/',
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
color: '#96e7ed',
|
|
91
|
+
supportedChains: starknet,
|
|
92
|
+
};
|
|
93
|
+
};
|
package/src/signer.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StarknetProviderAPI } from './helpers.js';
|
|
2
|
+
import type { SignerFactory } from 'rango-types';
|
|
3
|
+
|
|
4
|
+
import { DefaultStarknetSigner } from '@rango-dev/signer-starknet';
|
|
5
|
+
import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';
|
|
6
|
+
|
|
7
|
+
export default async function getSigners(
|
|
8
|
+
provider: StarknetProviderAPI
|
|
9
|
+
): Promise<SignerFactory> {
|
|
10
|
+
const signers = new DefaultSignerFactory();
|
|
11
|
+
signers.registerSigner(TxType.STARKNET, new DefaultStarknetSigner(provider));
|
|
12
|
+
return signers;
|
|
13
|
+
}
|