File tree Expand file tree Collapse file tree 7 files changed +35
-9
lines changed Expand file tree Collapse file tree 7 files changed +35
-9
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @web3-onboard/core" ,
3
- "version" : " 2.4.0-alpha.2 " ,
3
+ "version" : " 2.4.0-alpha.3 " ,
4
4
"repository" : " blocknative/web3-onboard" ,
5
5
"scripts" : {
6
6
"build" : " rollup -c" ,
Original file line number Diff line number Diff line change 70
70
"poweredBy" : " powered by" ,
71
71
"addAccount" : " Add Account" ,
72
72
"setPrimaryAccount" : " Set Primary Account" ,
73
- "disconnectWallet" : " Disconnect Wallet"
73
+ "disconnectWallet" : " Disconnect Wallet" ,
74
+ "copyAddress" : " Copy Wallet address"
74
75
},
75
76
"notify" : {
76
77
"transaction" : {
Original file line number Diff line number Diff line change @@ -83,6 +83,15 @@ export function shortenEns(ens: string): string {
83
83
return ens . length > 11 ? `${ ens . slice ( 0 , 4 ) } ...${ ens . slice ( - 6 ) } ` : ens
84
84
}
85
85
86
+ export async function copyWalletAddress ( text : string ) : Promise < void > {
87
+ try {
88
+ const copy = await navigator . clipboard . writeText ( text ) ;
89
+ return copy
90
+ } catch ( err ) {
91
+ console . error ( 'Failed to copy: ' , err )
92
+ }
93
+ }
94
+
86
95
export const chainIdToLabel : Record < string , string > = {
87
96
'0x1' : 'Ethereum' ,
88
97
'0x3' : 'Ropsten' ,
Original file line number Diff line number Diff line change 3
3
import { fade } from ' svelte/transition'
4
4
import { ProviderRpcErrorCode } from ' @web3-onboard/common'
5
5
import type { WalletState } from ' ../../types'
6
- import { shortenAddress , shortenEns } from ' ../../utils'
6
+ import { shortenAddress , shortenEns , copyWalletAddress } from ' ../../utils'
7
7
import en from ' ../../i18n/en.json'
8
8
import SuccessStatusIcon from ' ../shared/SuccessStatusIcon.svelte'
9
9
import WalletAppBadge from ' ../shared/WalletAppBadge.svelte'
48
48
}
49
49
}
50
50
}
51
+
52
+ function changeText() {
53
+ en .accountCenter .copyAddress = ' Copied Successfully'
54
+ setTimeout (hideMenu , 500 )
55
+ setTimeout (() => {
56
+ en .accountCenter .copyAddress = ' Copy Wallet address'
57
+ }, 700 )
58
+ }
51
59
</script >
52
60
53
61
<style >
225
233
default: en .accountCenter .disconnectWallet
226
234
})}
227
235
</li >
236
+ <li
237
+ on:click |stopPropagation ={() => {
238
+ copyWalletAddress (ens ? ens .name : address ).then (() => {
239
+ changeText ()
240
+ })
241
+ }}
242
+ >
243
+ {en .accountCenter .copyAddress }
244
+ </li >
228
245
</ul >
229
246
{/if }
230
247
</div >
Original file line number Diff line number Diff line change 213
213
// }
214
214
},
215
215
position: ' topRight'
216
- },
217
-
216
+ }
218
217
},
219
218
// Sign up for your free api key at www.Blocknative.com
220
219
apiKey: ' xxxxxx-bf21-42ec-a093-9d37e426xxxx'
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @web3-onboard/react" ,
3
- "version" : " 2.2.2 " ,
3
+ "version" : " 2.2.3-alpha.1 " ,
4
4
"description" : " Collection of React Hooks for web3-onboard" ,
5
5
"repository" : " blocknative/web3-onboard" ,
6
6
"module" : " dist/index.js" ,
24
24
"typescript" : " ^4.5.5"
25
25
},
26
26
"dependencies" : {
27
- "@web3-onboard/core" : " ^2.3.2 " ,
27
+ "@web3-onboard/core" : " ^2.4.0-alpha.3 " ,
28
28
"@web3-onboard/common" : " ^2.1.4" ,
29
29
"use-sync-external-store" : " 1.0.0"
30
30
},
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @web3-onboard/vue" ,
3
- "version" : " 2.1.2 " ,
3
+ "version" : " 2.1.3-alpha.1 " ,
4
4
"description" : " Vue Composable for web3-onboard" ,
5
5
"repository" : " blocknative/web3-onboard" ,
6
6
"module" : " dist/index.js" ,
25
25
"@vueuse/core" : " ^8.4.2" ,
26
26
"@vueuse/rxjs" : " ^8.2.0" ,
27
27
"@web3-onboard/common" : " ^2.1.4" ,
28
- "@web3-onboard/core" : " ^2.3.2 " ,
28
+ "@web3-onboard/core" : " ^2.4.0-alpha.3 " ,
29
29
"vue-demi" : " ^0.12.4"
30
30
},
31
31
"peerDependencies" : {
You can’t perform that action at this time.
0 commit comments