-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update docs for XDEFI wallet integration
- Loading branch information
Showing
23 changed files
with
1,294 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# Extension Wallet | ||
# Extension Wallet |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,85 @@ | ||
# Extension Wallet Binance Integration | ||
# Extension Wallet Binance Integration | ||
|
||
Develop Binance dApps | ||
|
||
## Transfer request | ||
|
||
- [Parameters description](https://docs.xdefi.io/docs/technical-documentation/xdefi-extension-integration/detect-xdefi-providers#parameters) | ||
|
||
```javascript | ||
const { asset, from, recipient, amount, memo } \= { | ||
asset: { | ||
chain: "BNB", | ||
symbol: "BNB", | ||
ticker: "BNB", | ||
}, | ||
from: 'xxxx', | ||
recipient: 'yyyy', | ||
amount: { | ||
amount: 500, | ||
decimals: 8 | ||
}, | ||
|
||
memo: 'hint' | ||
}; | ||
|
||
window.xfi.binance.request({ | ||
method: "transfer", | ||
params: [{ | ||
asset, | ||
from, | ||
recipient, | ||
amount, | ||
memo, | ||
}], | ||
}, | ||
|
||
(error, result) => { | ||
console.debug(error, result); | ||
this.lastResult \= { error, result }; | ||
}); | ||
``` | ||
|
||
## Accounts request | ||
|
||
```javascript | ||
if (window.xfi && window.xfi.binance) { | ||
window.xfi.binance.request( | ||
{ method: "request_accounts", params: [] }, | ||
(error, accounts) => console.log(`Binance accounts ${accounts}`), | ||
); | ||
} | ||
``` | ||
|
||
### Result example | ||
|
||
```json | ||
{ | ||
"error": null, | ||
"result": ["bitcoincash:qzxr6zwfhez9g06xmpe4n8xxls36rlkqlyv606v7zh"] | ||
} | ||
``` | ||
|
||
## Events | ||
|
||
### chainChanged | ||
|
||
```javascript | ||
if (window.xfi && window.xfi.binance) { | ||
const provider = window.xfi.binance; | ||
provider.on("chainChanged", (obj) => { | ||
console.log(`chainChanged::${obj.chainId}`, obj); | ||
}); | ||
} | ||
``` | ||
|
||
#### accountsChanged | ||
|
||
```javascript | ||
if (window.xfi && window.xfi.binance) { | ||
const provider = window.xfi.binance; | ||
provider.on("accountsChanged", (obj) => { | ||
console.log(`accountsChanged::${obj.chainId}`, obj); | ||
}); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,72 @@ | ||
# Extension Wallet Bitcoin Cash Integration | ||
# Extension Wallet Bitcoin Cash Integration | ||
|
||
Develop BitcoinCash dApps | ||
|
||
## Transfer request | ||
|
||
- [Parameters description](https://docs.xdefi.io/docs/technical-documentation/xdefi-extension-integration/detect-xdefi-providers#parameters) | ||
|
||
```javascript | ||
window.xfi.bitcoincash.request( | ||
{ | ||
method: "transfer", | ||
params: [ | ||
{ | ||
feeRate, | ||
from, | ||
recipient, | ||
amount, | ||
memo, | ||
}, | ||
], | ||
}, | ||
(error, result) => { | ||
console.debug(error, result); | ||
this.lastResult = { error, result }; | ||
}, | ||
); | ||
``` | ||
|
||
## Accounts request | ||
|
||
```javascript | ||
if (window.xfi && window.xfi.bitcoincash) { | ||
window.xfi.bitcoincash.request( | ||
{ method: "request_accounts", params: [] }, | ||
(error, accounts) => console.log(`Bitcoincash accounts ${accounts}`), | ||
); | ||
} | ||
``` | ||
|
||
### Result example | ||
|
||
```json | ||
{ | ||
"error": null, | ||
"result": ["bitcoincash:qzxr6zwfhez9g06xmpe4n8xxls36rlkqlyv606v7zh"] | ||
} | ||
``` | ||
|
||
## Events | ||
|
||
### chainChanged | ||
|
||
```javascript | ||
if (window.xfi && window.xfi.bitcoincash) { | ||
const provider = window.xfi.bitcoincash; | ||
provider.on("chainChanged", (obj) => { | ||
console.log(`chainChanged::${obj.chainId}`, obj); | ||
}); | ||
} | ||
``` | ||
|
||
### accountsChanged | ||
|
||
```javascript | ||
if (window.xfi && window.xfi.bitcoincash) { | ||
const provider = window.xfi.bitcoincash; | ||
provider.on("accountsChanged", (obj) => { | ||
console.log(`accountsChanged::${obj.chainId}`, obj); | ||
}); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,102 @@ | ||
# Extension Wallet Bitcoin Integration | ||
# Extension Wallet Bitcoin Integration | ||
|
||
Develop Bitcoin dApps | ||
|
||
Our BTC connection also implements the [sats-connect](https://docs.xverse.app/sats-connect/) interface for signing transactions. To use please install this [library](https://www.npmjs.com/package/@xdefi/btc-connect). | ||
|
||
## Transfer request | ||
|
||
- [Parameters description](https://docs.xdefi.io/docs/technical-documentation/xdefi-extension-integration) | ||
|
||
```javascript | ||
window.xfi.bitcoin.request( | ||
{ | ||
method: "transfer", | ||
params: [ | ||
{ | ||
feeRate, | ||
from, | ||
recipient, | ||
amount, | ||
memo, | ||
}, | ||
], | ||
}, | ||
(error, result) => { | ||
console.debug(error, result); | ||
this.lastResult = { error, result }; | ||
}, | ||
); | ||
``` | ||
|
||
## Change network | ||
|
||
```javascript | ||
window.xfi.bitcoin.changeNetwork("testnet"); //active network becomes testnet | ||
window.xfi.bitcoin.changeNetwork("mainnet"); //active network becomes mainnet | ||
``` | ||
|
||
## Accounts request (Mainnet) | ||
|
||
```javascript | ||
if (window.xfi && window.xfi.bitcoin) { | ||
window.xfi.bitcoin.request( | ||
{ method: "request_accounts", params: [] }, | ||
(error, accounts) => console.log(`Bitcoin accounts ${accounts}`), | ||
); | ||
} | ||
``` | ||
|
||
### Result example | ||
|
||
```json | ||
{ | ||
"error": null, | ||
"result": ["bc1qst9xyekxekaep7tk4wd7lmrwdyc9laqngx5qpr"] | ||
} | ||
``` | ||
|
||
## Accounts Request (Testnet) | ||
|
||
```javascript | ||
if (window.xfi && window.xfi.bitcoin) { | ||
window.xfi.bitcoin.changeNetwork("testnet"); | ||
window.xfi.bitcoin.request( | ||
{ method: "request_accounts", params: [] }, | ||
(error, accounts) => console.log(`Bitcoin accounts ${accounts}`), | ||
); | ||
} | ||
``` | ||
|
||
### Result example | ||
|
||
```json | ||
{ | ||
"error": null, | ||
"result": ["tb1......"] | ||
} | ||
``` | ||
|
||
## Events | ||
|
||
### chainChanged | ||
|
||
```javascript | ||
if (window.xfi && window.xfi.bitcoin) { | ||
const provider = window.xfi.bitcoin; | ||
provider.on("chainChanged", (obj) => { | ||
console.log(`chainChanged::${obj.chainId}`, obj); | ||
}); | ||
} | ||
``` | ||
|
||
### accountsChanged | ||
|
||
```javascript | ||
if (window.xfi && window.xfi.bitcoin) { | ||
const provider = window.xfi.bitcoin; | ||
provider.on("accountsChanged", (obj) => { | ||
console.log(`accountsChanged::${obj.chainId}`, obj); | ||
}); | ||
} | ||
``` |
Oops, something went wrong.