@rango-dev/provider-braavos 0.0.0-experimental-936229e8-20251208
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 +181 -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-braavos.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 +75 -0
- package/src/signer.ts +12 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# [0.49.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.48.1...provider-braavos@0.49.0) (2025-12-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## [0.48.1](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.48.0...provider-braavos@0.48.1) (2025-11-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# [0.46.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.45.0...provider-braavos@0.46.0) (2025-10-29)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# [0.45.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.44.0...provider-braavos@0.45.0) (2025-09-29)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [0.44.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.43.0...provider-braavos@0.44.0) (2025-09-06)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# [0.43.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.42.0...provider-braavos@0.43.0) (2025-08-19)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [0.42.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.41.0...provider-braavos@0.42.0) (2025-08-05)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# [0.41.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.40.0...provider-braavos@0.41.0) (2025-07-22)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Reverts
|
|
33
|
+
|
|
34
|
+
* Revert "chore(release): publish" ([064ce15](https://github.com/rango-exchange/rango-client/commit/064ce157a2f819856f647f83aeb1c0410542e8d7))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# [0.39.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.38.1...provider-braavos@0.39.0) (2025-06-09)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## [0.38.1](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.38.0...provider-braavos@0.38.1) (2025-05-04)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# [0.38.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.37.0...provider-braavos@0.38.0) (2025-04-30)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Bug Fixes
|
|
50
|
+
|
|
51
|
+
* rename pbt to ptb for sui ([3d6d89f](https://github.com/rango-exchange/rango-client/commit/3d6d89f2265766607a15d61e0df92643fb33072b))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Features
|
|
55
|
+
|
|
56
|
+
* update sui to consider recent api changes ([d764b25](https://github.com/rango-exchange/rango-client/commit/d764b2501df9bb295f63cdbc0b05acd4a3abb4b9))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# [0.37.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.36.0...provider-braavos@0.37.0) (2025-03-11)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# [0.36.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.35.0...provider-braavos@0.36.0) (2025-02-23)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
# [0.35.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.34.0...provider-braavos@0.35.0) (2024-12-30)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
# [0.34.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.33.0...provider-braavos@0.34.0) (2024-11-27)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
# [0.33.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.32.0...provider-braavos@0.33.0) (2024-11-12)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
# [0.32.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.31.0...provider-braavos@0.32.0) (2024-10-12)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### Bug Fixes
|
|
84
|
+
|
|
85
|
+
* bump sdk and fix type issues ([d442208](https://github.com/rango-exchange/rango-client/commit/d4422083bf5dd27d5f509ce1db7f9560d05428c8))
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
### Performance Improvements
|
|
89
|
+
|
|
90
|
+
* lazy load signer packages ([7b88f18](https://github.com/rango-exchange/rango-client/commit/7b88f1834f7b29b4b81ab6c81a07bb88e8ccf55c))
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# [0.31.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.30.0...provider-braavos@0.31.0) (2024-09-10)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
# [0.30.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.29.1...provider-braavos@0.30.0) (2024-08-11)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## [0.29.1](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.29.0...provider-braavos@0.29.1) (2024-07-14)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# [0.29.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.27.0...provider-braavos@0.29.0) (2024-07-09)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
# [0.28.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.27.0...provider-braavos@0.28.0) (2024-06-01)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
# [0.27.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.26.0...provider-braavos@0.27.0) (2024-05-14)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# [0.26.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.25.0...provider-braavos@0.26.0) (2024-04-24)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
# [0.25.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.24.0...provider-braavos@0.25.0) (2024-04-23)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
# [0.24.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.23.0...provider-braavos@0.24.0) (2024-04-09)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
### Bug Fixes
|
|
130
|
+
|
|
131
|
+
* fix the connection problem that happens when another wallet takes over the requested one ([42df212](https://github.com/rango-exchange/rango-client/commit/42df2120aadd84c95045b0bf76844c19305fb59a))
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
# [0.23.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.22.0...provider-braavos@0.23.0) (2024-03-12)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
# [0.22.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.21.0...provider-braavos@0.22.0) (2024-02-20)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
# [0.21.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.20.0...provider-braavos@0.21.0) (2024-02-07)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
# [0.20.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.19.0...provider-braavos@0.20.0) (2024-01-22)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
### Bug Fixes
|
|
151
|
+
|
|
152
|
+
* cleanup wallets' subscriber when setProvider get null ([88d6a42](https://github.com/rango-exchange/rango-client/commit/88d6a423c49b34b3d9ff567e22df36c3b009bb76))
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
# [0.19.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.17.0...provider-braavos@0.19.0) (2023-12-24)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
### Bug Fixes
|
|
160
|
+
|
|
161
|
+
* fix HMR for widget and playground ([8524820](https://github.com/rango-exchange/rango-client/commit/8524820f10cf0b8921f3db0c4f620ff98daa4103))
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
# [0.7.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.6.0...provider-braavos@0.7.0) (2023-08-03)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
# [0.6.0](https://github.com/rango-exchange/rango-client/compare/provider-braavos@0.5.0...provider-braavos@0.6.0) (2023-08-01)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
# 0.2.0 (2023-07-31)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
### Features
|
|
177
|
+
|
|
178
|
+
* support braavos wallet ([fb38ebe](https://github.com/rango-exchange/rango-client/commit/fb38ebef00a33b92cabf506c88ef83d8c77cce84))
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,QAIjC"}
|
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 { getBraavosInstance } from './helpers.js';
|
|
5
|
+
export declare const config: {
|
|
6
|
+
type: WalletTypes;
|
|
7
|
+
defaultNetwork: Networks;
|
|
8
|
+
};
|
|
9
|
+
export declare const getInstance: typeof getBraavosInstance;
|
|
10
|
+
export declare const connect: Connect;
|
|
11
|
+
export declare const subscribe: Subscribe;
|
|
12
|
+
export declare const canSwitchNetworkTo: CanSwitchNetwork;
|
|
13
|
+
export declare const getSigners: (provider: any) => 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,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKlD,eAAO,MAAM,MAAM;;;CAGlB,CAAC;AAEF,eAAO,MAAM,WAAW,2BAAqB,CAAC;AAE9C,eAAO,MAAM,OAAO,EAAE,OAOrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,SAYvB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,gBAA8B,CAAC;AAEhE,eAAO,MAAM,UAAU,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,OAAO,CAAC,aAAa,CAAU,CAAC;AAE5E,eAAO,MAAM,eAAe,EAAE,eACF,CAAC;AAE7B,eAAO,MAAM,aAAa,EAAE,CAAC,cAAc,EAAE,cAAc,EAAE,KAAK,UAoBjE,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var l=Object.defineProperty;var o=(e,t)=>l(e,"name",{value:t,configurable:!0});import{Networks as r,WalletTypes as h}from"@rango-dev/wallets-shared";import{starknetBlockchain as f}from"rango-types";function s(){let{starknet_braavos:e}=window;return e||null}o(s,"getBraavosInstance");import{DefaultStarknetSigner as m}from"@rango-dev/signer-starknet";import{DefaultSignerFactory as g,TransactionType as p}from"rango-types";async function n(e){let t=new g;return t.registerSigner(p.STARKNET,new m(e)),t}o(n,"getSigners");var d=h.BRAAVOS,j={type:d,defaultNetwork:r.STARKNET},A=s,B=o(async({instance:e})=>{let t=await e?.enable();if(!t?.length||!e.isConnected)throw new Error("Connection Error");return{accounts:t||[],chainId:r.STARKNET}},"connect"),N=o(({instance:e,state:t,updateAccounts:c})=>{let a=o(i=>{t.connected&&e&&c([i],r.STARKNET)},"handleAccountsChanged");return e?.on?.("accountsChanged",a),()=>{e?.off?.("accountsChanged",a)}},"subscribe"),F=o(()=>!1,"canSwitchNetworkTo"),I=n,R=o(({instance:e})=>e.isPreauthorized(),"canEagerConnect"),W=o(e=>{let t=f(e);return{name:"Braavos",img:"https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/braavos/icon.svg",installLink:{CHROME:"https://chrome.google.com/webstore/detail/braavos-smart-wallet/jnlgamecbpmbajjfhmmmlhejkemejdma",BRAVE:"https://chrome.google.com/webstore/detail/braavos-smart-wallet/jnlgamecbpmbajjfhmmmlhejkemejdma",FIREFOX:"https://addons.mozilla.org/en-US/firefox/addon/braavos-wallet/",EDGE:"https://microsoftedge.microsoft.com/addons/detail/braavos-wallet/hkkpjehhcnhgefhbdcgfkeegglpjchdc",DEFAULT:"https://braavos.app/"},color:"#96e7ed",supportedChains:t}},"getWalletInfo");export{R as canEagerConnect,F as canSwitchNetworkTo,j as config,B as connect,A as getInstance,I as getSigners,W as getWalletInfo,N 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 { getBraavosInstance } from './helpers.js';\nimport signer from './signer.js';\n\nconst WALLET = WalletTypes.BRAAVOS;\n\nexport const config = {\n type: WALLET,\n defaultNetwork: Networks.STARKNET,\n};\n\nexport const getInstance = getBraavosInstance;\n\nexport const connect: Connect = async ({ instance }) => {\n const accounts = await instance?.enable();\n if (!accounts?.length || !instance.isConnected) {\n throw new Error('Connection Error');\n }\n\n return { accounts: accounts || [], chainId: Networks.STARKNET };\n};\n\nexport const subscribe: Subscribe = ({ instance, state, updateAccounts }) => {\n const handleAccountsChanged = (accounts: any) => {\n if (state.connected) {\n if (instance) {\n updateAccounts([accounts], Networks.STARKNET);\n }\n }\n };\n instance?.on?.('accountsChanged', handleAccountsChanged);\n return () => {\n instance?.off?.('accountsChanged', handleAccountsChanged);\n };\n};\n\nexport const canSwitchNetworkTo: CanSwitchNetwork = () => false;\n\nexport const getSigners: (provider: any) => 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: 'Braavos',\n img: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/braavos/icon.svg',\n installLink: {\n CHROME:\n 'https://chrome.google.com/webstore/detail/braavos-smart-wallet/jnlgamecbpmbajjfhmmmlhejkemejdma',\n BRAVE:\n 'https://chrome.google.com/webstore/detail/braavos-smart-wallet/jnlgamecbpmbajjfhmmmlhejkemejdma',\n FIREFOX: 'https://addons.mozilla.org/en-US/firefox/addon/braavos-wallet/',\n EDGE: 'https://microsoftedge.microsoft.com/addons/detail/braavos-wallet/hkkpjehhcnhgefhbdcgfkeegglpjchdc',\n DEFAULT: 'https://braavos.app/',\n },\n\n color: '#96e7ed',\n supportedChains: starknet,\n };\n};\n", "export function getBraavosInstance() {\n const { starknet_braavos } = window;\n if (!!starknet_braavos) return starknet_braavos;\n return null;\n}\n", "import 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: any\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,cCV5B,SAASC,GAAqB,CACnC,GAAM,CAAE,iBAAAC,CAAiB,EAAI,OAC7B,OAAMA,GACC,IACT,CAJgBC,EAAAF,EAAA,sBCEhB,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,cFU9B,IAAMO,EAASC,EAAY,QAEdC,EAAS,CACpB,KAAMF,EACN,eAAgBG,EAAS,QAC3B,EAEaC,EAAcC,EAEdC,EAAmBC,EAAA,MAAO,CAAE,SAAAC,CAAS,IAAM,CACtD,IAAMC,EAAW,MAAMD,GAAU,OAAO,EACxC,GAAI,CAACC,GAAU,QAAU,CAACD,EAAS,YACjC,MAAM,IAAI,MAAM,kBAAkB,EAGpC,MAAO,CAAE,SAAUC,GAAY,CAAC,EAAG,QAASN,EAAS,QAAS,CAChE,EAPgC,WASnBO,EAAuBH,EAAA,CAAC,CAAE,SAAAC,EAAU,MAAAG,EAAO,eAAAC,CAAe,IAAM,CAC3E,IAAMC,EAAwBN,EAACE,GAAkB,CAC3CE,EAAM,WACJH,GACFI,EAAe,CAACH,CAAQ,EAAGN,EAAS,QAAQ,CAGlD,EAN8B,yBAO9B,OAAAK,GAAU,KAAK,kBAAmBK,CAAqB,EAChD,IAAM,CACXL,GAAU,MAAM,kBAAmBK,CAAqB,CAC1D,CACF,EAZoC,aAcvBC,EAAuCP,EAAA,IAAM,GAAN,sBAEvCQ,EAAwDA,EAExDC,EAAmCT,EAAA,CAAC,CAAE,SAAAC,CAAS,IAC1DA,EAAS,gBAAgB,EADqB,mBAGnCS,EAAkEV,EAC7EW,GACG,CACH,IAAMC,EAAWC,EAAmBF,CAAc,EAClD,MAAO,CACL,KAAM,UACN,IAAK,wFACL,YAAa,CACX,OACE,kGACF,MACE,kGACF,QAAS,iEACT,KAAM,oGACN,QAAS,sBACX,EAEA,MAAO,UACP,gBAAiBC,CACnB,CACF,EApB+E",
|
|
6
|
+
"names": ["Networks", "WalletTypes", "starknetBlockchain", "getBraavosInstance", "starknet_braavos", "__name", "DefaultStarknetSigner", "DefaultSignerFactory", "TxType", "getSigners", "provider", "signers", "DefaultSignerFactory", "TxType", "DefaultStarknetSigner", "__name", "WALLET", "WalletTypes", "config", "Networks", "getInstance", "getBraavosInstance", "connect", "__name", "instance", "accounts", "subscribe", "state", "updateAccounts", "handleAccountsChanged", "canSwitchNetworkTo", "getSigners", "canEagerConnect", "getWalletInfo", "allBlockChains", "starknet", "starknetBlockchain"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/helpers.ts":{"bytes":146,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/signer.ts":{"bytes":431,"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":2333,"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":4949},"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":1264},"src/helpers.ts":{"bytesInOutput":85},"src/signer.ts":{"bytesInOutput":236}},"bytes":1844}}}
|
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,wBAA8B,UAAU,CACtC,QAAQ,EAAE,GAAG,GACZ,OAAO,CAAC,aAAa,CAAC,CAIxB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rango-dev/provider-braavos",
|
|
3
|
+
"version": "0.0.0-experimental-936229e8-20251208",
|
|
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-braavos",
|
|
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.0.0-experimental-936229e8-20251208",
|
|
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-braavos
|
package/src/helpers.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
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 { getBraavosInstance } from './helpers.js';
|
|
14
|
+
import signer from './signer.js';
|
|
15
|
+
|
|
16
|
+
const WALLET = WalletTypes.BRAAVOS;
|
|
17
|
+
|
|
18
|
+
export const config = {
|
|
19
|
+
type: WALLET,
|
|
20
|
+
defaultNetwork: Networks.STARKNET,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const getInstance = getBraavosInstance;
|
|
24
|
+
|
|
25
|
+
export const connect: Connect = async ({ instance }) => {
|
|
26
|
+
const accounts = await instance?.enable();
|
|
27
|
+
if (!accounts?.length || !instance.isConnected) {
|
|
28
|
+
throw new Error('Connection Error');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return { accounts: accounts || [], chainId: Networks.STARKNET };
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const subscribe: Subscribe = ({ instance, state, updateAccounts }) => {
|
|
35
|
+
const handleAccountsChanged = (accounts: any) => {
|
|
36
|
+
if (state.connected) {
|
|
37
|
+
if (instance) {
|
|
38
|
+
updateAccounts([accounts], Networks.STARKNET);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
instance?.on?.('accountsChanged', handleAccountsChanged);
|
|
43
|
+
return () => {
|
|
44
|
+
instance?.off?.('accountsChanged', handleAccountsChanged);
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const canSwitchNetworkTo: CanSwitchNetwork = () => false;
|
|
49
|
+
|
|
50
|
+
export const getSigners: (provider: any) => Promise<SignerFactory> = signer;
|
|
51
|
+
|
|
52
|
+
export const canEagerConnect: CanEagerConnect = ({ instance }) =>
|
|
53
|
+
instance.isPreauthorized();
|
|
54
|
+
|
|
55
|
+
export const getWalletInfo: (allBlockChains: BlockchainMeta[]) => WalletInfo = (
|
|
56
|
+
allBlockChains
|
|
57
|
+
) => {
|
|
58
|
+
const starknet = starknetBlockchain(allBlockChains);
|
|
59
|
+
return {
|
|
60
|
+
name: 'Braavos',
|
|
61
|
+
img: 'https://raw.githubusercontent.com/rango-exchange/assets/main/wallets/braavos/icon.svg',
|
|
62
|
+
installLink: {
|
|
63
|
+
CHROME:
|
|
64
|
+
'https://chrome.google.com/webstore/detail/braavos-smart-wallet/jnlgamecbpmbajjfhmmmlhejkemejdma',
|
|
65
|
+
BRAVE:
|
|
66
|
+
'https://chrome.google.com/webstore/detail/braavos-smart-wallet/jnlgamecbpmbajjfhmmmlhejkemejdma',
|
|
67
|
+
FIREFOX: 'https://addons.mozilla.org/en-US/firefox/addon/braavos-wallet/',
|
|
68
|
+
EDGE: 'https://microsoftedge.microsoft.com/addons/detail/braavos-wallet/hkkpjehhcnhgefhbdcgfkeegglpjchdc',
|
|
69
|
+
DEFAULT: 'https://braavos.app/',
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
color: '#96e7ed',
|
|
73
|
+
supportedChains: starknet,
|
|
74
|
+
};
|
|
75
|
+
};
|
package/src/signer.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SignerFactory } from 'rango-types';
|
|
2
|
+
|
|
3
|
+
import { DefaultStarknetSigner } from '@rango-dev/signer-starknet';
|
|
4
|
+
import { DefaultSignerFactory, TransactionType as TxType } from 'rango-types';
|
|
5
|
+
|
|
6
|
+
export default async function getSigners(
|
|
7
|
+
provider: any
|
|
8
|
+
): Promise<SignerFactory> {
|
|
9
|
+
const signers = new DefaultSignerFactory();
|
|
10
|
+
signers.registerSigner(TxType.STARKNET, new DefaultStarknetSigner(provider));
|
|
11
|
+
return signers;
|
|
12
|
+
}
|