Skip to content

feat: add ICP token creation support#357

Merged
lalalune merged 1 commit into
elizaOS:mainfrom
asDNSk:main
Nov 29, 2024
Merged

feat: add ICP token creation support#357
lalalune merged 1 commit into
elizaOS:mainfrom
asDNSk:main

Conversation

@asDNSk
Copy link
Copy Markdown
Contributor

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

@mcp97 mcp97 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!

@mcp97
Copy link
Copy Markdown
Contributor

mcp97 commented Nov 19, 2024

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
Copy Markdown
Contributor Author

asDNSk commented Nov 19, 2024

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

@NashAiomos
Copy link
Copy Markdown

Oh yeah

@lalalune lalalune merged commit 1aeaab2 into elizaOS:main Nov 29, 2024
@asDNSk asDNSk changed the title feat(plugin): add ICP token creation support feat: add ICP token creation support Dec 1, 2024
lalalune added a commit that referenced this pull request Dec 1, 2024
fix: follow-up improvements for ICP token creation (PR #357)
lalalune added a commit that referenced this pull request May 3, 2026
fix: follow-up improvements for ICP token creation (PR #357)
FranceFlapjack pushed a commit to FranceFlapjack/eliza that referenced this pull request May 16, 2026
fix: follow-up improvements for ICP token creation (PR elizaOS#357)
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