Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: request import token #38

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/getting-started/imgs/import-token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions docs/getting-started/import-custom-token.md
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
- <b>Assets in Plug</b> 🎨:
- Tokens: getting-started/custom-tokens.md
- Non-fungible Tokens (NFTs): getting-started/nfts.md
Expand Down