Skip to content

Commit

Permalink
chore: update ic_panda_frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Dec 17, 2024
1 parent 5b5415d commit e84b7d8
Show file tree
Hide file tree
Showing 30 changed files with 393 additions and 142 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ opt-level = 's'

[workspace.package]
edition = "2021"
version = "2.9.0"
version = "2.9.1"
repository = "https://github.com/ldclabs/ic-panda"
keywords = ["canister", "icp", "panda"]
categories = ["web-programming"]
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# ICPanda DAO
🐼 A decentralized Panda meme platform featuring E2E encrypted messaging, lucky draws, airdrops.
🐼 A technical panda fully running on the Internet Computer blockchain, building chain-native infrastructures and practical Web3 apps.

About us: https://dmsg.net/panda

## dMsg (ICPanda Message)

Expand Down
25 changes: 25 additions & 0 deletions proposals/proposal-280.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

# Load the environment variables
source "$(pwd)"/proposals/env.sh

# build and get batch_id, evidence:
# dfx deploy ic_panda_frontend --ic --by-proposal

export BLOB="$(didc encode --format blob '(record {batch_id=66:nat; evidence=blob "\b9\3d\73\be\22\aa\fe\c7\3b\59\f3\4e\8d\d6\3c\36\c9\7d\a1\d5\51\da\07\a5\ab\c3\c3\01\1e\64\ec\2f"})')"

quill sns make-proposal --canister-ids-file ./sns_canister_ids.json --pem-file $PROPOSAL_PEM_FILE $PROPOSAL_NEURON_ID --proposal "(
record {
title = \"Execute commit_proposed_batch() to release ic_panda_frontend v2.9.0\";
url = \"https://panda.fans/\";
summary = \"This proposal executes commit_proposed_batch() on c63a7-6yaaa-aaaap-ab3gq-cai to release ic_panda_frontend v2.9.0.\n\n1. chore: update landing page.\";
action = opt variant {
ExecuteGenericNervousSystemFunction = record {
function_id = 1000 : nat64;
payload = ${BLOB};
}
};
}
)" > proposal-message.json

# quill send proposal-message.json
4 changes: 2 additions & 2 deletions src/ic_message_frontend/src/routes/(app)/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -508,13 +508,13 @@
>
</p>
<p class="mt-2 text-center text-sm capitalize antialiased">
A decentralized Panda meme brand fully running on the <a
A technical panda fully running on the <a
class="underline underline-offset-4"
href="https://dashboard.internetcomputer.org/sns/d7wvo-iiaaa-aaaaq-aacsq-cai"
target="_blank"
>
Internet Computer
</a> blockchain.
</a> blockchain, building chain-native infras and practical Web3 apps.
</p>
</div>
</footer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@
>
</p>
<p class="mt-2 text-center text-sm capitalize antialiased">
A decentralized Panda meme brand fully running on the <a
A technical panda fully running on the <a
class="underline underline-offset-4"
href="https://dashboard.internetcomputer.org/sns/d7wvo-iiaaa-aaaaq-aacsq-cai"
target="_blank"
>
Internet Computer
</a> blockchain.
</a> blockchain, building chain-native infras and practical Web3 apps.
</p>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion src/ic_panda_frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@
"test": "vitest run"
},
"type": "module",
"version": "2.8.0"
"version": "2.9.0"
}
7 changes: 4 additions & 3 deletions src/ic_panda_frontend/src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@

<title>ICPanda DAO</title>
<link href="https://panda.fans" rel="canonical" />
<meta content="ICPanda DAO" property="og:title" />
<meta content="A decentralized Panda meme platform featuring E2E encrypted messaging, lucky draws, airdrops."
<meta content="ICPanda" property="og:title" />
<meta
content="A technical panda fully running on the Internet Computer blockchain, building chain-native infras and practical Web3 apps."
name="description" property="og:description" />
<meta content="website" property="og:type" />
<meta content="https://panda.fans" property="og:url" />
Expand All @@ -26,7 +27,7 @@
<!-- iOS meta tags & icons -->
<meta name="mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-status-bar-style" content="#5bbad5" />
<meta name="mobile-web-app-title" content="ICPanda DAO" />
<meta name="mobile-web-app-title" content="ICPanda" />
<link rel="apple-touch-icon" href="/_assets/favicons/apple-touch-icon.png" />
<link rel="mask-icon" href="/_assets/favicons/safari-pinned-tab.svg" color="#5bbad5" />

Expand Down
24 changes: 12 additions & 12 deletions src/ic_panda_frontend/src/declarations/ck-doge-canister/index.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
import { Actor, HttpAgent } from "@dfinity/agent";
import { Actor, HttpAgent } from "@dfinity/agent"

// Imports and re-exports candid interface
import { idlFactory } from "./ck-doge-canister.did.js";
export { idlFactory } from "./ck-doge-canister.did.js";
import { idlFactory } from "./ck-doge-canister.did.js"
export { idlFactory } from "./ck-doge-canister.did.js"

/* CANISTER_ID is replaced by webpack based on node environment
* Note: canister environment variable will be standardized as
* process.env.CANISTER_ID_<CANISTER_NAME_UPPERCASE>
* beginning in dfx 0.15.0
*/
export const canisterId =
process.env.CANISTER_ID_CK_DOGE_CANISTER;
process.env.CANISTER_ID_CK_DOGE_CANISTER

export const createActor = (canisterId, options = {}) => {
const agent = options.agent || new HttpAgent({ ...options.agentOptions });
const agent = options.agent || new HttpAgent({ ...options.agentOptions })

if (options.agent && options.agentOptions) {
console.warn(
"Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent."
);
)
}

// Fetch root key for certificate validation during development
if (process.env.DFX_NETWORK !== "ic") {
agent.fetchRootKey().catch((err) => {
dynAgent.fetchRootKey().catch((err) => {
console.warn(
"Unable to fetch root key. Check to ensure that your local replica is running"
);
console.error(err);
});
)
console.error(err)
})
}

// Creates an actor with using the candid interface and the HttpAgent
return Actor.createActor(idlFactory, {
agent,
canisterId,
...options.actorOptions,
});
};
})
}
24 changes: 12 additions & 12 deletions src/ic_panda_frontend/src/declarations/ck-doge-minter/index.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
import { Actor, HttpAgent } from "@dfinity/agent";
import { Actor, HttpAgent } from "@dfinity/agent"

// Imports and re-exports candid interface
import { idlFactory } from "./ck-doge-minter.did.js";
export { idlFactory } from "./ck-doge-minter.did.js";
import { idlFactory } from "./ck-doge-minter.did.js"
export { idlFactory } from "./ck-doge-minter.did.js"

/* CANISTER_ID is replaced by webpack based on node environment
* Note: canister environment variable will be standardized as
* process.env.CANISTER_ID_<CANISTER_NAME_UPPERCASE>
* beginning in dfx 0.15.0
*/
export const canisterId =
process.env.CANISTER_ID_CK_DOGE_MINTER;
process.env.CANISTER_ID_CK_DOGE_MINTER

export const createActor = (canisterId, options = {}) => {
const agent = options.agent || new HttpAgent({ ...options.agentOptions });
const agent = options.agent || new HttpAgent({ ...options.agentOptions })

if (options.agent && options.agentOptions) {
console.warn(
"Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent."
);
)
}

// Fetch root key for certificate validation during development
if (process.env.DFX_NETWORK !== "ic") {
agent.fetchRootKey().catch((err) => {
dynAgent.fetchRootKey().catch((err) => {
console.warn(
"Unable to fetch root key. Check to ensure that your local replica is running"
);
console.error(err);
});
)
console.error(err)
})
}

// Creates an actor with using the candid interface and the HttpAgent
return Actor.createActor(idlFactory, {
agent,
canisterId,
...options.actorOptions,
});
};
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
type PublicTokenOverview =
record {
address: text;
feesUSD: float64;
id: nat;
name: text;
priceUSD: float64;
priceUSDChange: float64;
standard: text;
symbol: text;
totalVolumeUSD: float64;
txCount: int;
volumeUSD: float64;
volumeUSD1d: float64;
volumeUSD7d: float64;
};

service : { getToken: (text) -> (PublicTokenOverview) query; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { ActorMethod } from '@dfinity/agent'
import type { IDL } from '@dfinity/candid'

export interface PublicTokenOverview {
address: string
feesUSD: number
id: number
name: string
priceUSD: number
priceUSDChange: number
standard: string
symbol: string
totalVolumeUSD: number
txCount: number
volumeUSD: number
volumeUSD1d: number
volumeUSD7d: number
}

export interface _SERVICE {
'getToken': ActorMethod<[string], PublicTokenOverview>
}
export declare const idlFactory: IDL.InterfaceFactory
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export const idlFactory = ({ IDL }) => {
const UpgradeArgs = IDL.Record({
'preparers': IDL.Opt(IDL.Vec(IDL.Principal)),
'committers': IDL.Opt(IDL.Vec(IDL.Principal)),
})
const InitArgs = IDL.Record({
'preparers': IDL.Vec(IDL.Principal),
'committers': IDL.Vec(IDL.Principal),
})
const MinterArgs = IDL.Variant({
'Upgrade': UpgradeArgs,
'Init': InitArgs,
})
const LinkLog = IDL.Record({
'rewards': IDL.Nat64,
'linker': IDL.Tuple(IDL.Principal, IDL.Principal),
'minted_at': IDL.Nat64,
})
const PublicTokenOverview = IDL.Record({
'address': IDL.Text,
'feesUSD': IDL.Float64,
'id': IDL.Nat,
'name': IDL.Text,
'priceUSD': IDL.Float64,
'priceUSDChange': IDL.Float64,
'standard': IDL.Text,
'symbol': IDL.Text,
'totalVolumeUSD': IDL.Float64,
'txCount': IDL.Int,
'volumeUSD': IDL.Float64,
'volumeUSD1d': IDL.Float64,
'volumeUSD7d': IDL.Float64,
})
return IDL.Service({
'getToken': IDL.Func([IDL.Text], [PublicTokenOverview], ['query']),
})
}
15 changes: 10 additions & 5 deletions src/ic_panda_frontend/src/lib/canisters/actors.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
import { agent } from '$lib/stores/auth'
import { AuthAgent, dynAgent } from '$lib/utils/auth'
import { Actor, type ActorMethod, type ActorSubclass } from '@dfinity/agent'
import type { IDL } from '@dfinity/candid'
import type { Principal } from '@dfinity/principal'

export function createActor<T = Record<string, ActorMethod>>({
canisterId,
idlFactory
idlFactory,
agent
}: {
canisterId: string | Principal
idlFactory: IDL.InterfaceFactory
agent?: AuthAgent
}): ActorSubclass<T> {
// Creates an actor with using the candid interface and the HttpAgent
agent = agent || dynAgent
return Actor.createActor(idlFactory, {
// queryTransform or callTransform
// callTransform: (methodName: string, args: unknown[], callConfig: any) => {
// console.log('callTransform', methodName, args, callConfig)
// console.log('caller', agent?.id.getPrincipal().toText())
// },
agent,
canisterId
// queryTransform: (methodName: string, args: unknown[], callConfig: any) => {
// console.log('queryTransform', methodName, args, callConfig)
// }
})
}
Loading

0 comments on commit e84b7d8

Please sign in to comment.