cdk-rs icon indicating copy to clipboard operation
cdk-rs copied to clipboard

Consider adding __cdk_name

Open lastmjs opened this issue 2 years ago • 4 comments

I've opened this issue with 3 additional CDK projects:

As we've been developing CDKs (TypeScript/JavaScript with Azle and Python with Kybra), we've been thinking about how to measure adoption of various CDKs. In addition to GitHub metrics (such as analyzing dfx.json), it might be a powerful metric to know exactly how many canisters use a particular CDK. For Azle and Kybra, we're adding a simple method __cdk_name that returns a string with the name of the CDK. This will allow canister indexers like https://icscan.io/ to index canisters by CDK. This could allow viewing of various CDK metrics over time, which I think would be very interesting to many different parties on the IC.

Here's our suggested implementation of the method in cdk-rs:

#[ic_cdk_macros::query]
fn __cdk_name() -> String {
    "cdk-rs".to_string()
}

Here's our suggested implementation of the method in Azle:

#[ic_cdk_macros::query]
fn __cdk_name() -> String {
    "azle".to_string()
}

Here's our suggested implementation of the method in Kybra:

#[ic_cdk_macros::query]
fn __cdk_name() -> String {
    "kybra".to_string()
}

Do you have any thoughts on this pattern?

lastmjs avatar Sep 26 '22 17:09 lastmjs

I raised some questions about the design at https://github.com/dfinity/motoko/issues/3462

nomeata avatar Sep 26 '22 18:09 nomeata

I think it's best to move forward with what is being suggested here: https://github.com/dfinity/motoko/issues/3462#issuecomment-1258599165

lastmjs avatar Sep 26 '22 22:09 lastmjs

A custom metadata section (e.g., icp:public cdk_name) might be a better option. https://internetcomputer.org/docs/current/references/ic-interface-spec/#state-tree-canister-information

UPD: Ah, Joachim suggested the same thing.

roman-kashitsyn avatar Sep 27 '22 08:09 roman-kashitsyn

We'd like to discuss this topic more in the next developer tooling working group. Please join if you can!

sesi200 avatar Sep 28 '22 11:09 sesi200

Fulfilled by recent work on tech_stack. https://github.com/dfinity/sdk/pull/3670

lwshang avatar Apr 12 '24 16:04 lwshang