Can be called to retreive a users BCH/SLP/BTC address.
The address returned by this method may not repreent all the funds in the users control, and calling the method multiple times could return different addresses, depending on the wallet provider.
import bitcoincomLink from'bitcoincom-link';bitcoincomLink.getAddress({ protocol:'BCH',}).then((data:GetAccountOutput)=>{const{ address, label,}= data;console.log('User address: '+ address);console.log('User address label (Optional): '+ label);}).catch(({type: string, description: string, data: any})=>{switch(type){caseNO_PROVIDER:console.log('No provider available.');break;caseCANCELED:console.log('The user has canceled this request.');break;casePROTOCOL_ERROR:console.log('The provided protocol is not supported by this wallet.');break;}});
Demo
Provider Request Handling
Depending on the account structure of the wallet, user handling may be different. In all cases, the wallet MUST return an address & protocol, or an error message. Each wallet may choose to provide back a default address in all cases, while others with multiple accounts and HD keys, may prompt a user to select an account from which to provide a new address.