Skip to content

Commit

Permalink
feat(icp): configure for testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
imsk17 committed Aug 24, 2024
1 parent 387e7db commit 8cf27fa
Show file tree
Hide file tree
Showing 16 changed files with 243 additions and 312 deletions.
10 changes: 10 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ export const bridgeTestChains = [
nativeCoinSymbol: "EGLD",
lastBlock: 4757826,
},
{
chainType: "icp",
chain: "ICP",
contractAddress: "bw4dl-smaaa-aaaaa-qaacq-cai",
decimals: 9,
intialFund: "100000000",
lastBlock: 0,
nativeCoinSymbol: "ICP",
rpcURL: "https://tools.xp.network/",
},
] as const satisfies TChain[];

export const storageTestnetConfig: IEvmChainConfig = {
Expand Down
86 changes: 0 additions & 86 deletions src/contractsTypes/icp/bridge/bridge.did

This file was deleted.

118 changes: 0 additions & 118 deletions src/contractsTypes/icp/bridge/bridge.did.js

This file was deleted.

112 changes: 112 additions & 0 deletions src/contractsTypes/icp/bridge/bridge.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
//@ts-nocheck generated code cope

export const idlFactory = ({ IDL }) => {
const AddValidator = IDL.Record({
principal: IDL.Principal,
public_key: IDL.Text,
});
const SignerAndSignature = IDL.Record({
signature: IDL.Text,
signer: IDL.Text,
});
const BlacklistValidator = IDL.Record({
principal: IDL.Principal,
public_key: IDL.Text,
});
const ClaimData = IDL.Record({
fee: IDL.Nat64,
source_chain: IDL.Text,
lock_tx_chain: IDL.Text,
transaction_hash: IDL.Text,
token_amount: IDL.Nat,
destination_chain: IDL.Text,
token_id: IDL.Nat,
source_nft_contract_address: IDL.Text,
metadata: IDL.Text,
name: IDL.Text,
nft_type: IDL.Text,
royalty: IDL.Nat,
royalty_receiver: IDL.Principal,
destination_user_address: IDL.Principal,
symbol: IDL.Text,
});
const ClaimedEvent = IDL.Record({
source_chain: IDL.Text,
lock_tx_chain: IDL.Text,
transaction_hash: IDL.Text,
token_id: IDL.Nat,
nft_contract: IDL.Principal,
});
const LockedEvent = IDL.Record({
source_chain: IDL.Text,
token_amount: IDL.Nat,
destination_chain: IDL.Text,
token_id: IDL.Nat,
source_nft_contract_address: IDL.Principal,
nft_type: IDL.Text,
destination_user_address: IDL.Text,
});
const Validator = IDL.Record({
address: IDL.Principal,
pending_rewards: IDL.Nat64,
});
const XPBridge = IDL.Service({
acceptCycles: IDL.Func([], [], []),
add_validator: IDL.Func(
[AddValidator, IDL.Vec(SignerAndSignature)],
[],
[]
),
availableCycles: IDL.Func([], [IDL.Nat], ["query"]),
blacklist_validator: IDL.Func(
[BlacklistValidator, IDL.Vec(SignerAndSignature)],
[],
[]
),
claim_nft: IDL.Func(
[ClaimData, IDL.Vec(SignerAndSignature)],
[IDL.Text],
[]
),
claim_validator_rewards: IDL.Func([IDL.Text], [IDL.Nat64, IDL.Nat64], []),
encode_add_validator: IDL.Func(
[AddValidator],
[IDL.Vec(IDL.Nat8)],
["query"]
),
encode_blacklist_validator: IDL.Func(
[BlacklistValidator],
[IDL.Vec(IDL.Nat8)],
["query"]
),
encode_claim_data: IDL.Func([ClaimData], [IDL.Vec(IDL.Nat8)], ["query"]),
get_blacklisted_validators: IDL.Func(
[IDL.Text],
[IDL.Opt(IDL.Bool)],
["query"]
),
get_claimed_data: IDL.Func([IDL.Text], [IDL.Opt(ClaimedEvent)], ["query"]),
get_hash_from_nonce: IDL.Func([IDL.Nat], [IDL.Opt(IDL.Text)], ["query"]),
get_locked_data: IDL.Func([IDL.Text], [IDL.Opt(LockedEvent)], ["query"]),
get_nonce: IDL.Func([], [IDL.Nat], ["query"]),
get_validator: IDL.Func([IDL.Text], [IDL.Opt(Validator)], ["query"]),
get_validator_count: IDL.Func([], [IDL.Nat], ["query"]),
init: IDL.Func([], [], []),
lock_nft: IDL.Func(
[IDL.Principal, IDL.Nat, IDL.Text, IDL.Text],
[IDL.Text],
[]
),
});
return XPBridge;
};
export const init = ({ IDL }) => {
return [
IDL.Record({
storage_deployer: IDL.Principal,
collection_deployer: IDL.Principal,
chain_type: IDL.Text,
validators: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Principal)),
}),
];
};
50 changes: 0 additions & 50 deletions src/contractsTypes/icp/bridge/index.d.ts

This file was deleted.

Loading

0 comments on commit 8cf27fa

Please sign in to comment.