-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move imported tokens to a separate file
- Loading branch information
1 parent
d914ee4
commit 2d4c3be
Showing
5 changed files
with
57 additions
and
38 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
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { nnsDappCanister } from "$lib/api/nns-dapp.api"; | ||
import type { | ||
ImportedToken, | ||
ImportedTokens, | ||
} from "$lib/canisters/nns-dapp/nns-dapp.types"; | ||
import { logWithTimestamp } from "$lib/utils/dev.utils"; | ||
import type { Identity } from "@dfinity/agent"; | ||
|
||
export const getImportedTokens = async ({ | ||
identity, | ||
certified, | ||
}: { | ||
identity: Identity; | ||
certified: boolean; | ||
}): Promise<ImportedTokens> => { | ||
logWithTimestamp(`Getting imported tokens:${certified} call...`); | ||
|
||
const { canister: nnsDapp } = await nnsDappCanister({ identity }); | ||
const response = await nnsDapp.getImportedTokens({ certified }); | ||
|
||
logWithTimestamp(`Getting imported tokens:${certified} complete`); | ||
|
||
return response; | ||
}; | ||
|
||
export const setImportedTokens = async ({ | ||
identity, | ||
importedTokens, | ||
}: { | ||
identity: Identity; | ||
importedTokens: Array<ImportedToken>; | ||
}): Promise<void> => { | ||
logWithTimestamp("Setting imported tokens call..."); | ||
|
||
const { canister: nnsDapp } = await nnsDappCanister({ identity }); | ||
await nnsDapp.setImportedTokens(importedTokens); | ||
|
||
logWithTimestamp("Setting imported tokens call complete."); | ||
}; |
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
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
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