Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions advanced/dapps/react-dapp-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@
"@multiversx/sdk-core": "12.18.0",
"@multiversx/sdk-wallet": "4.2.0",
"@noble/curves": "^1.8.1",
"@noble/hashes": "^1.8.0",
"@noble/secp256k1": "^2.2.3",
"@polkadot/util-crypto": "^10.1.2",
"@reown/appkit": "1.7.5",
"@solana/web3.js": "^1.36.0",
"@stacks/network": "^7.0.2",
"@stacks/transactions": "^7.0.6",
"@walletconnect/core": "^2.19.1",
"@walletconnect/encoding": "^1.0.1",
"@walletconnect/jsonrpc-utils": "^1.0.8",
Expand Down
79 changes: 71 additions & 8 deletions advanced/dapps/react-dapp-v2/pnpm-lock.yaml

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

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions advanced/dapps/react-dapp-v2/src/chains/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as tron from "./tron";
import * as tezos from "./tezos";
import * as kadena from "./kadena";
import * as bip122 from "./bip122";
import * as stacks from "./stacks";

import { ChainMetadata, ChainRequestRender } from "../helpers";

Expand All @@ -36,6 +37,8 @@ export function getChainMetadata(chainId: string): ChainMetadata {
return tezos.getChainMetadata(chainId);
case "bip122":
return bip122.getChainMetadata(chainId);
case "stacks":
return stacks.getChainMetadata(chainId);
default:
throw new Error(`No metadata handler for namespace ${namespace}`);
}
Expand Down
40 changes: 40 additions & 0 deletions advanced/dapps/react-dapp-v2/src/chains/stacks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { NamespaceMetadata, ChainMetadata, ChainsMap } from "../helpers";

export const StacksChainData: ChainsMap = {
"1": {
id: "stacks:1",
name: "Stacks Mainnet",
rpc: [],
slip44: 195,
testnet: false,
},
"2147483648": {
id: "stacks:2147483648",
name: "Stacks Testnet",
rpc: [],
slip44: 195,
testnet: true,
},
};

export const StacksMetadata: NamespaceMetadata = {
// Stacks Mainnet
"1": {
logo: "/assets/stacks.png",
rgb: "85, 70, 254",
},
// Stacks TestNet
"2147483648": {
logo: "/assets/stacks.png",
rgb: "85, 70, 254",
},
};

export function getChainMetadata(chainId: string): ChainMetadata {
const reference = chainId.split(":")[1];
const metadata = StacksMetadata[reference];
if (typeof metadata === "undefined") {
throw new Error(`No chain metadata found for chainId: ${chainId}`);
}
return metadata;
}
15 changes: 15 additions & 0 deletions advanced/dapps/react-dapp-v2/src/constants/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const DEFAULT_MAIN_CHAINS = [
"tezos:mainnet",
"kadena:mainnet01",
"bip122:000000000019d6689c085ae165831e93",
"stacks:1",
];

export const DEFAULT_TEST_CHAINS = [
Expand All @@ -40,6 +41,7 @@ export const DEFAULT_TEST_CHAINS = [
"tezos:testnet",
"kadena:testnet04",
"bip122:000000000933ea01ad0ee984209779ba",
"stacks:2147483648",
];

export const DEFAULT_CHAINS = [...DEFAULT_MAIN_CHAINS, ...DEFAULT_TEST_CHAINS];
Expand Down Expand Up @@ -258,6 +260,19 @@ export enum DEFAULT_TEZOS_METHODS {

export enum DEFAULT_TEZOS_EVENTS {}

/**
* STACKS
*/
export enum DEFAULT_STACKS_METHODS {
STACKS_SEND_TRANSFER = "stacks_stxTransfer",
STACKS_SIGN_MESSAGE = "stacks_signMessage",
}

export enum DEFAULT_STACKS_EVENTS {
STACKS_CHAIN_CHANGED = "stacks_chainChanged",
STACKS_ACCOUNTS_CHANGED = "stacks_accountsChanged",
}

export const DEFAULT_GITHUB_REPO_URL =
"https://github.com/WalletConnect/web-examples/tree/main/dapps/react-dapp-v2";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { EIP155ChainData } from "../chains/eip155";
import { TezosChainData } from "../chains/tezos";
import { KadenaChainData } from "../chains/kadena";
import { BtcChainData } from "../chains/bip122";
import { StacksChainData } from "../chains/stacks";

/**
* Types
Expand Down Expand Up @@ -77,6 +78,9 @@ export function ChainDataContextProvider({
case "bip122":
chains = BtcChainData;
break;
case "stacks":
chains = StacksChainData;
break;
default:
console.error("Unknown chain namespace: ", namespace);
}
Expand Down
Loading