@@ -11,7 +11,7 @@ import {
1111} from "@solana/web3.js" ;
1212import { Keccak } from "sha3" ;
1313import IDL from "../idl/json/token_router.json" ;
14- import { TokenRouter } from "../idl/ts/token_router" ;
14+ import { type TokenRouter as TokenRouterType } from "../idl/ts/token_router" ;
1515import {
1616 CctpTokenBurnMessage ,
1717 MessageTransmitterProgram ,
@@ -29,6 +29,7 @@ import { BPF_LOADER_UPGRADEABLE_PROGRAM_ID, programDataAddress } from "../utils"
2929import { VaaAccount } from "../wormhole" ;
3030import { Custodian , PreparedFill , PreparedOrder } from "./state" ;
3131import { ChainId , Network , isChainId } from "@wormhole-foundation/sdk-base" ;
32+ import { TokenRouter } from "@wormhole-foundation/example-liquidity-layer-definitions" ;
3233
3334export const PROGRAM_IDS = [
3435 "TokenRouter11111111111111111111111111111111" ,
@@ -37,19 +38,6 @@ export const PROGRAM_IDS = [
3738
3839export type ProgramId = ( typeof PROGRAM_IDS ) [ number ] | string ;
3940
40- export type TokenRouterAddresses = {
41- tokenRouter : string ;
42- // upstream wormhole
43- matchingEngine : string ;
44- coreBridge : string ;
45- // cctp
46- usdcMint : string ;
47- messageTransmitter : string ;
48- tokenMessenger : string ;
49- //
50- upgradeManager : string ;
51- } ;
52-
5341export type PrepareMarketOrderArgs = {
5442 amountIn : bigint ;
5543 minAmountOut : bigint | null ;
@@ -128,16 +116,13 @@ export type AddCctpRouterEndpointArgs = {
128116
129117export class TokenRouterProgram {
130118 private _programId : ProgramId ;
131- private _addresses : TokenRouterAddresses ;
119+ private _addresses : TokenRouter . Addresses ;
132120
133- program : Program < TokenRouter > ;
121+ program : Program < TokenRouterType > ;
134122
135- // TODO: fix this
136- constructor ( connection : Connection , programId : ProgramId , addresses ?: TokenRouterAddresses ) {
123+ constructor ( connection : Connection , programId : ProgramId , addresses ?: TokenRouter . Addresses ) {
137124 this . _programId = programId ;
138-
139125 this . _addresses = addresses ! ;
140-
141126 this . program = new Program (
142127 { ...( IDL as any ) , address : this . _programId } ,
143128 {
0 commit comments