-
Notifications
You must be signed in to change notification settings - Fork 612
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(plugin): add ICP token creation support #357
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
modelClass: ModelClass.LARGE, | ||
}); | ||
|
||
console.log("Response:", response); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this
telegram: response.telegram, | ||
}); | ||
|
||
console.log("Token created successfully:", createTokenResult); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
import type { Principal } from "@dfinity/principal"; | ||
import type { ActorSubclass } from "@dfinity/agent"; | ||
import type { IDL } from "@dfinity/candid"; | ||
export interface ICPConfig { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: space
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this comment
@@ -0,0 +1,21 @@ | |||
// hex text -> number array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can remove and use util for these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
BREAKING CHANGE: None