Skip to content

Commit c1f0fca

Browse files
committed
wip
1 parent bfd8c12 commit c1f0fca

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed

contract_manager/src/chains.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,3 +858,51 @@ export class TonChain extends Chain {
858858
return Number(balance) / 10 ** 9;
859859
}
860860
}
861+
862+
export class NearChain extends Chain {
863+
static type = "NearChain";
864+
865+
constructor(
866+
id: string,
867+
mainnet: boolean,
868+
wormholeChainName: string,
869+
nativeToken: TokenId | undefined,
870+
) {
871+
super(id, mainnet, wormholeChainName, nativeToken);
872+
}
873+
874+
static fromJson(parsed: ChainConfig & { networkId: number }): NearChain {
875+
if (parsed.type !== NearChain.type) throw new Error("Invalid type");
876+
return new NearChain(
877+
parsed.id,
878+
parsed.mainnet,
879+
parsed.wormholeChainName,
880+
parsed.nativeToken,
881+
);
882+
}
883+
884+
getType(): string {
885+
return TonChain.type;
886+
}
887+
888+
toJson(): KeyValueConfig {
889+
return {
890+
id: this.id,
891+
wormholeChainName: this.wormholeChainName,
892+
mainnet: this.mainnet,
893+
type: TonChain.type,
894+
};
895+
}
896+
897+
generateGovernanceUpgradePayload(upgradeInfo: unknown): Buffer {
898+
throw new Error("governance is unsupported on Near")
899+
}
900+
901+
getAccountAddress(privateKey: PrivateKey): Promise<string> {
902+
throw new Error("unsupported")
903+
}
904+
905+
getAccountBalance(privateKey: PrivateKey): Promise<number> {
906+
throw new Error("unsupported")
907+
}
908+
}

contract_manager/src/store.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
GlobalChain,
99
SuiChain,
1010
TonChain,
11+
NearChain,
1112
} from "./chains";
1213
import {
1314
AptosPriceFeedContract,
@@ -85,6 +86,7 @@ export class Store {
8586
[FuelChain.type]: FuelChain,
8687
[StarknetChain.type]: StarknetChain,
8788
[TonChain.type]: TonChain,
89+
[NearChain.type]: NearChain,
8890
};
8991

9092
this.getYamlFiles(`${this.path}/chains/`).forEach((yamlFile) => {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- id: near_testnet
2+
wormholeChainName: near_testnet
3+
mainnet: false
4+
type: NearChain
5+
- id: near
6+
wormholeChainName: near
7+
mainnet: true
8+
type: NearChain

governance/xc_admin/packages/xc_admin_common/src/chains.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export const RECEIVER_CHAINS = {
104104
threat_level_midnight: 60074,
105105
just_breathe: 60075,
106106
rabechain_mainnet: 60076,
107+
near: 60077,
107108

108109
// Testnets as a separate chain ids (to use stable data sources and governance for them)
109110
injective_testnet: 60013,
@@ -228,6 +229,7 @@ export const RECEIVER_CHAINS = {
228229
bittensor_testnet: 50115,
229230
monad_devnet: 50116,
230231
monad_testnet: 50117,
232+
near_testnet: 50118,
231233
};
232234

233235
// If there is any overlapping value the receiver chain will replace the wormhole

0 commit comments

Comments
 (0)