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 11{
22 "name" : " @web3-onboard/core" ,
3- "version" : " 2.4.0-alpha.2 " ,
3+ "version" : " 2.4.0-alpha.3 " ,
44 "repository" : " blocknative/web3-onboard" ,
55 "scripts" : {
66 "build" : " rollup -c" ,
Original file line number Diff line number Diff line change 7070 "poweredBy" : " powered by" ,
7171 "addAccount" : " Add Account" ,
7272 "setPrimaryAccount" : " Set Primary Account" ,
73- "disconnectWallet" : " Disconnect Wallet"
73+ "disconnectWallet" : " Disconnect Wallet" ,
74+ "copyAddress" : " Copy Wallet address"
7475 },
7576 "notify" : {
7677 "transaction" : {
Original file line number Diff line number Diff line change @@ -83,6 +83,15 @@ export function shortenEns(ens: string): string {
8383 return ens . length > 11 ? `${ ens . slice ( 0 , 4 ) } ...${ ens . slice ( - 6 ) } ` : ens
8484}
8585
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+
8695export const chainIdToLabel : Record < string , string > = {
8796 '0x1' : 'Ethereum' ,
8897 '0x3' : 'Ropsten' ,
Original file line number Diff line number Diff line change 33 import { fade } from ' svelte/transition'
44 import { ProviderRpcErrorCode } from ' @web3-onboard/common'
55 import type { WalletState } from ' ../../types'
6- import { shortenAddress , shortenEns } from ' ../../utils'
6+ import { shortenAddress , shortenEns , copyWalletAddress } from ' ../../utils'
77 import en from ' ../../i18n/en.json'
88 import SuccessStatusIcon from ' ../shared/SuccessStatusIcon.svelte'
99 import WalletAppBadge from ' ../shared/WalletAppBadge.svelte'
4848 }
4949 }
5050 }
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+ }
5159 </script >
5260
5361<style >
225233 default: en .accountCenter .disconnectWallet
226234 })}
227235 </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 >
228245 </ul >
229246 {/if }
230247 </div >
Original file line number Diff line number Diff line change 213213 // }
214214 },
215215 position: ' topRight'
216- },
217-
216+ }
218217 },
219218 // Sign up for your free api key at www.Blocknative.com
220219 apiKey: ' xxxxxx-bf21-42ec-a093-9d37e426xxxx'
Original file line number Diff line number Diff line change 11{
22 "name" : " @web3-onboard/react" ,
3- "version" : " 2.2.2 " ,
3+ "version" : " 2.2.3-alpha.1 " ,
44 "description" : " Collection of React Hooks for web3-onboard" ,
55 "repository" : " blocknative/web3-onboard" ,
66 "module" : " dist/index.js" ,
2424 "typescript" : " ^4.5.5"
2525 },
2626 "dependencies" : {
27- "@web3-onboard/core" : " ^2.3.2 " ,
27+ "@web3-onboard/core" : " ^2.4.0-alpha.3 " ,
2828 "@web3-onboard/common" : " ^2.1.4" ,
2929 "use-sync-external-store" : " 1.0.0"
3030 },
Original file line number Diff line number Diff line change 11{
22 "name" : " @web3-onboard/vue" ,
3- "version" : " 2.1.2 " ,
3+ "version" : " 2.1.3-alpha.1 " ,
44 "description" : " Vue Composable for web3-onboard" ,
55 "repository" : " blocknative/web3-onboard" ,
66 "module" : " dist/index.js" ,
2525 "@vueuse/core" : " ^8.4.2" ,
2626 "@vueuse/rxjs" : " ^8.2.0" ,
2727 "@web3-onboard/common" : " ^2.1.4" ,
28- "@web3-onboard/core" : " ^2.3.2 " ,
28+ "@web3-onboard/core" : " ^2.4.0-alpha.3 " ,
2929 "vue-demi" : " ^0.12.4"
3030 },
3131 "peerDependencies" : {
You can’t perform that action at this time.
0 commit comments