feat: add ICP token creation support#357
Conversation
- Add plugin-icp to enable token creation on Pickpump platform - Implement createToken functionality for Internet Computer Protocol (ICP) - Support ICP token standard and specifications - Enable seamless integration with Pickpump's token creation flow BREAKING CHANGE: None
|
this is fucking rad, will review later |
| import { unwrapRustResultMap } from "../utils/common/types/results"; | ||
| import { icpWalletProvider } from "../providers/wallet"; | ||
|
|
||
| const createTokenTemplate = `Respond with a JSON markdown block containing only the extracted values. Use null for any values that cannot be determined. |
There was a problem hiding this comment.
Can we move this into a templates file for readability? Thanks so much!
| ): Promise<any> { | ||
| const actor: _SERVICE = await creator( | ||
| idlFactory, | ||
| "bn4fo-iyaaa-aaaap-akp6a-cai" |
There was a problem hiding this comment.
Can this be moved to a constants file?
| name: tokenInfo.name ?? "My ICP Token", | ||
| symbol: tokenInfo.symbol ?? "MIT", | ||
| description: tokenInfo.description ?? "A fun meme token on ICP", | ||
| logo: "https://icptoken.default.logo", |
| modelClass: ModelClass.LARGE, | ||
| }); | ||
|
|
||
| console.log("Response:", response); |
| telegram: response.telegram, | ||
| }); | ||
|
|
||
| console.log("Token created successfully:", createTokenResult); |
| import type { Principal } from "@dfinity/principal"; | ||
| import type { ActorSubclass } from "@dfinity/agent"; | ||
| import type { IDL } from "@dfinity/candid"; | ||
| export interface ICPConfig { |
| export const customStringify = (v: any): string => | ||
| JSON.stringify(v, (_key, value) => { | ||
| if (typeof value === "bigint") return `${value}`; | ||
| if (value && typeof value === "object" && value._isPrincipal === true) { |
There was a problem hiding this comment.
For readability: else if probably more appropriate
| export const handleShowPrice = (value: number | string, fixed = 8) => { | ||
| if (!value || value === "0") return 0; | ||
| return _.round(Number(value), fixed); | ||
| // return value / 1e18; |
| @@ -0,0 +1,21 @@ | |||
| // hex text -> number array | |||
There was a problem hiding this comment.
We could consider moving this to the array utils as they are all related to arrays
| import { string2array } from "../arrays"; | ||
|
|
||
| // Principal -> string | ||
| export const principal2string = (p: Principal): string => p.toText(); |
There was a problem hiding this comment.
Can remove and use util for these
mcp97
left a comment
There was a problem hiding this comment.
This is some amazing work - thank you for working on this! Added a handful of small nits feel free to address and we are good to go!
|
Also feel free to fix the PR Title check, add in a a screen grab of successful token creation, and consider an integration test to simulate the entire token creation flow using mocks or a test canister to ensure the plugin works end-to-end. Also can we update the plugin associated READMEs so it is easier to leverage. Thanks so much! So sorry for all the comments! You are a badass and did some great work here! |
|
Thank u for ur review, I will fix the issues. @monilpat |
|
Oh yeah |
fix: follow-up improvements for ICP token creation (PR #357)
fix: follow-up improvements for ICP token creation (PR #357)
fix: follow-up improvements for ICP token creation (PR elizaOS#357)
BREAKING CHANGE: None