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(plugin): add ICP token creation support #357

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

asDNSk
Copy link

@asDNSk asDNSk commented Nov 16, 2024

  • 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

- 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
@lalalune
Copy link
Member

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.
Copy link
Contributor

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"
Copy link
Contributor

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",
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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 {
Copy link
Contributor

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) {
Copy link
Contributor

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;
Copy link
Contributor

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
Copy link
Contributor

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();
Copy link
Contributor

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

Copy link
Contributor

@monilpat monilpat left a 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!

@monilpat
Copy link
Contributor

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!

@asDNSk
Copy link
Author

asDNSk commented Nov 19, 2024

Thank u for ur review, I will fix the issues. @monilpat

@NashAiomos
Copy link

Oh yeah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants