diff --git a/docs/getting-started/imgs/import-token.png b/docs/getting-started/imgs/import-token.png new file mode 100644 index 0000000..68217fe Binary files /dev/null and b/docs/getting-started/imgs/import-token.png differ diff --git a/docs/getting-started/import-custom-token.md b/docs/getting-started/import-custom-token.md new file mode 100644 index 0000000..c5b4f18 --- /dev/null +++ b/docs/getting-started/import-custom-token.md @@ -0,0 +1,31 @@ +--- +date: "1" +--- + +![](imgs/custom-tokens.png) + +## Request Import Tokens + +### requestImportToken(RequestImportTokenParams) + +requestImportToken() is an [asynchronous](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous) method to request the user to import a DIP20 or EXT token, which takes the parameter `RequestImportTokenParams` that is an object of fields: + +RequestTransferParams: + +- canisterId (string) +- standard ('DIP20 | 'EXT') + +The response data is a boolean or an Error. + +As an example, copy and paste the following code snippet into the console and execute it. + +```js +(async () => { + const result = await window.ic.plug.requestImportToken({ + canisterId: 'tgodh-faaaa-aaaab-qaefa-cai', + standard: 'DIP20', + }); + console.log(result); +})(); +``` +![](imgs/import-token.png) diff --git a/mkdocs.yml b/mkdocs.yml index 5018e9e..5fd800e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -29,6 +29,7 @@ nav: - Connect apps to Plug: getting-started/connect-to-plug.md - Using the Agent/Actor: getting-started/making-calls.md - Balances and Transactions: getting-started/balances-transactions.md + - Import custom token: getting-started/import-custom-token.md - Assets in Plug 🎨: - Tokens: getting-started/custom-tokens.md - Non-fungible Tokens (NFTs): getting-started/nfts.md