import { P as o, L as h, S as R, T as Q, ac as O, B as b, j as Z, D as v, K as j, l as Y, _ as ee } from "./unsignedTransaction-DCDxTFq8.mjs";
import { P as E, c as N, i as I } from "./index-BU35GfG0.mjs";
import { C as y, bd as _, m as ne, b as x, aJ as se, de as D, au as ae } from "./platform-Cil_UtAQ.mjs";
import { p as B, u as te, b as ie } from "./web3-CUwFm9Lx.mjs";
const k = new o("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
new o("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");
const A = new o("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");
new o("So11111111111111111111111111111111111111112");
new o("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");
class re extends Error {
  constructor(e) {
    super(e);
  }
}
class me extends re {
  constructor() {
    super(...arguments), this.name = "TokenOwnerOffCurveError";
  }
}
const oe = h.struct([
  h.u32("mintAuthorityOption"),
  B("mintAuthority"),
  te("supply"),
  h.u8("decimals"),
  ie("isInitialized"),
  h.u32("freezeAuthorityOption"),
  B("freezeAuthority")
]);
oe.span;
function ue(i, e, a = !1, s = k, t = A) {
  if (!a && !o.isOnCurve(e.toBuffer()))
    throw new me();
  const [n] = o.findProgramAddressSync([e.toBuffer(), s.toBuffer(), i.toBuffer()], t);
  return n;
}
function le(i, e, a, s, t = k, n = A) {
  return de(i, e, a, s, y.alloc(0), t, n);
}
function de(i, e, a, s, t, n = k, r = A) {
  const u = [
    { pubkey: i, isSigner: !0, isWritable: !0 },
    { pubkey: e, isSigner: !1, isWritable: !0 },
    { pubkey: a, isSigner: !1, isWritable: !1 },
    { pubkey: s, isSigner: !1, isWritable: !1 },
    { pubkey: R.programId, isSigner: !1, isWritable: !1 },
    { pubkey: n, isSigner: !1, isWritable: !1 }
  ];
  return new Q({
    keys: u,
    programId: r,
    data: t
  });
}
function U(i, e) {
  return new E(F.TokenMessengerIdl, new o(i), e === void 0 ? { connection: null } : e);
}
function ce(i, e) {
  return U(i, N(e));
}
function L(i, e) {
  return new E(F.MessageTransmitterIdl, new o(i), e === void 0 ? { connection: null } : e);
}
function ge(i, e) {
  return L(i, N(e));
}
const m = (i, e, a) => {
  const s = [y.from(I.bytes.utf8.encode(i))];
  if (a)
    for (const n of a)
      typeof n == "string" ? s.push(y.from(I.bytes.utf8.encode(n))) : Array.isArray(n) ? s.push(y.from(n)) : y.isBuffer(n) ? s.push(n) : s.push(n.toBuffer());
  const t = o.findProgramAddressSync(s, e);
  return { publicKey: t[0], bump: t[1] };
};
function fe(i, e, a, s, t, n, r, u, d) {
  const l = m("message_transmitter", i), c = m("token_messenger", e), f = m("token_minter", e), p = m("local_token", e, [a]), M = m("remote_token_messenger", e, [s.toString()]), S = m("sender_authority", e), P = U(e), T = m("__event_authority", e);
  return P.methods.depositForBurn({
    amount: new O(u.toString()),
    destinationDomain: s,
    mintRecipient: new o(r.toUint8Array())
  }).accounts({
    owner: t,
    senderAuthorityPda: S.publicKey,
    burnTokenAccount: n,
    messageTransmitter: l.publicKey,
    tokenMessenger: c.publicKey,
    remoteTokenMessenger: M.publicKey,
    tokenMinter: f.publicKey,
    localToken: p.publicKey,
    burnTokenMint: a,
    messageTransmitterProgram: i,
    tokenMessengerMinterProgram: e,
    tokenProgram: k,
    eventAuthority: T.publicKey,
    eventRentPayer: t,
    messageSentEventData: d
  }).instruction();
}
const C = 6400n;
function W(i) {
  return (i - BigInt(1)) / C * C + BigInt(1);
}
function z(i, e, a) {
  const s = e.toString();
  return m("used_nonces", a, [s, W(i).toString()]).publicKey;
}
async function pe(i, e, a, s, t, n) {
  const r = y.from(_.serialize(s)), u = y.from(ne.decode(t)), d = new o(a), l = new o(s.payload.burnToken.toUint8Array()), c = new b(s.payload.mintRecipient).unwrap(), f = n ? new o(n) : c, p = s.sourceDomain.toString(), M = m("message_transmitter", i), S = m("token_messenger", e), P = m("token_minter", e), T = m("local_token", e, [d]), V = m("remote_token_messenger", e, [p]), H = m("token_pair", e, [
    p,
    l
  ]), G = m("custody", e, [d]), X = m("message_transmitter_authority", i, [e]).publicKey, J = z(s.nonce, s.sourceDomain, i), $ = m("__event_authority", i), q = m("__event_authority", e), g = [];
  g.push({
    isSigner: !1,
    isWritable: !1,
    pubkey: S.publicKey
  }), g.push({
    isSigner: !1,
    isWritable: !1,
    pubkey: V.publicKey
  }), g.push({
    isSigner: !1,
    isWritable: !0,
    pubkey: P.publicKey
  }), g.push({
    isSigner: !1,
    isWritable: !0,
    pubkey: T.publicKey
  }), g.push({
    isSigner: !1,
    isWritable: !1,
    pubkey: H.publicKey
  }), g.push({
    isSigner: !1,
    isWritable: !0,
    pubkey: c
  }), g.push({
    isSigner: !1,
    isWritable: !0,
    pubkey: G.publicKey
  }), g.push({
    isSigner: !1,
    isWritable: !1,
    pubkey: k
  }), g.push({
    isSigner: !1,
    isWritable: !1,
    pubkey: q.publicKey
  }), g.push({
    isSigner: !1,
    isWritable: !1,
    pubkey: e
  });
  const K = L(i);
  return K.methods.receiveMessage({
    message: r,
    attestation: u
  }).accounts({
    payer: f,
    caller: f,
    authorityPda: X,
    messageTransmitter: M.publicKey,
    usedNonces: J,
    receiver: e,
    systemProgram: R.programId,
    eventAuthority: $.publicKey,
    program: K.programId
  }).remainingAccounts(g).transaction();
}
class w {
  network;
  chain;
  connection;
  contracts;
  tokenMessenger;
  messageTransmitter;
  constructor(e, a, s, t) {
    if (this.network = e, this.chain = a, this.connection = s, this.contracts = t, e === "Devnet")
      throw new Error("CircleBridge not supported on Devnet");
    const n = t.cctp?.messageTransmitter;
    if (!n)
      throw new Error(`Circle Messenger Transmitter contract for domain ${a} not found`);
    this.messageTransmitter = ge(new o(n), this.connection);
    const r = t.cctp?.tokenMessenger;
    if (!r)
      throw new Error(`Circle Token Messenger contract for domain ${a} not found`);
    this.tokenMessenger = ce(new o(r), this.connection);
  }
  static async fromRpc(e, a) {
    const [s, t] = await Z.chainFromRpc(e), n = a[t];
    if (n.network !== s)
      throw new Error(`Network mismatch: ${n.network} != ${s}`);
    return new w(s, t, e, n.contracts);
  }
  async *redeem(e, a, s) {
    const t = new o(x.get(this.network, this.chain)), n = new b(e).unwrap(), r = new b(a.payload.mintRecipient).unwrap();
    if (!await this.connection.getAccountInfo(r)) {
      const c = new v().add(le(n, r, n, t));
      c.feePayer = n, yield this.createUnsignedTx({ transaction: c }, "CircleBridge.CreateATA");
    }
    const d = await pe(this.messageTransmitter.programId, this.tokenMessenger.programId, t, a, s, n), l = new v();
    l.feePayer = n, l.add(d), yield this.createUnsignedTx({ transaction: l }, "CircleBridge.Redeem");
  }
  async *transfer(e, a, s) {
    const t = new o(x.get(this.network, this.chain)), n = new b(e).unwrap(), r = ue(t, n), u = se.get(this.network, a.chain), d = a.address.toUniversalAddress(), l = j.generate(), c = await fe(this.messageTransmitter.programId, this.tokenMessenger.programId, t, u, n, r, d, s, l.publicKey), f = new v();
    f.feePayer = n, f.add(c), yield this.createUnsignedTx({ transaction: f, signers: [l] }, "CircleBridge.Transfer");
  }
  async isTransferCompleted(e) {
    const a = z(e.nonce, e.sourceDomain, this.messageTransmitter.programId), s = W(e.nonce), { usedNonces: t } = await this.messageTransmitter.account.usedNonces.fetch(a), n = Number(e.nonce - s), r = t[Math.floor(n / 64)];
    if (!r)
      throw new Error("Invalid nonce byte index");
    const u = n % 64, d = new O((BigInt(1) << BigInt(u)).toString());
    return !r.and(d).isZero();
  }
  // Fetch the transaction logs and parse the CircleTransferMessage
  async parseTransactionDetails(e) {
    const a = await this.connection.getTransaction(e);
    if (!a || !a.meta)
      throw new Error("Transaction not found");
    const s = a.transaction.message.getAccountKeys();
    if (s.length < 2)
      throw new Error("No message account found");
    const t = s.get(1), n = await this.connection.getAccountInfo(t);
    if (!n)
      throw new Error("No account data found");
    const r = new Uint8Array(n.data).slice(44), [u, d] = _.deserialize(r), { payload: l } = u, c = l.messageSender, f = l.mintRecipient, p = D(this.network, u.sourceDomain), M = D(this.network, u.destinationDomain), S = { chain: p, address: l.burnToken };
    return {
      from: { chain: p, address: c },
      to: { chain: M, address: f },
      token: S,
      amount: l.amount,
      message: u,
      id: { hash: d }
    };
  }
  createUnsignedTx(e, a, s = !1) {
    return new Y(e, this.network, this.chain, a, s);
  }
}
const ye = {
  version: "0.1.0",
  name: "token_messenger_minter",
  instructions: [
    {
      name: "initialize",
      accounts: [
        {
          name: "payer",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "upgradeAuthority",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "authorityPda",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "tokenMessenger",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "tokenMinter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "tokenMessengerMinterProgramData",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "tokenMessengerMinterProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "systemProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "InitializeParams"
          }
        }
      ]
    },
    {
      name: "transferOwnership",
      accounts: [
        {
          name: "owner",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "tokenMessenger",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "TransferOwnershipParams"
          }
        }
      ]
    },
    {
      name: "acceptOwnership",
      accounts: [
        {
          name: "pendingOwner",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "tokenMessenger",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "AcceptOwnershipParams"
          }
        }
      ]
    },
    {
      name: "addRemoteTokenMessenger",
      accounts: [
        {
          name: "payer",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "owner",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "tokenMessenger",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "remoteTokenMessenger",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "systemProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "AddRemoteTokenMessengerParams"
          }
        }
      ]
    },
    {
      name: "removeRemoteTokenMessenger",
      accounts: [
        {
          name: "payee",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "owner",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "tokenMessenger",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "remoteTokenMessenger",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "RemoveRemoteTokenMessengerParams"
          }
        }
      ]
    },
    {
      name: "depositForBurn",
      accounts: [
        {
          name: "owner",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "eventRentPayer",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "senderAuthorityPda",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "burnTokenAccount",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "tokenMessenger",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "remoteTokenMessenger",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "tokenMinter",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "localToken",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "burnTokenMint",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "messageSentEventData",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "messageTransmitterProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "tokenMessengerMinterProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "tokenProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "systemProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "DepositForBurnParams"
          }
        }
      ],
      returns: "u64"
    },
    {
      name: "depositForBurnWithCaller",
      accounts: [
        {
          name: "owner",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "eventRentPayer",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "senderAuthorityPda",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "burnTokenAccount",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "tokenMessenger",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "remoteTokenMessenger",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "tokenMinter",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "localToken",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "burnTokenMint",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "messageSentEventData",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "messageTransmitterProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "tokenMessengerMinterProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "tokenProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "systemProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "DepositForBurnWithCallerParams"
          }
        }
      ],
      returns: "u64"
    },
    {
      name: "replaceDepositForBurn",
      accounts: [
        {
          name: "owner",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "eventRentPayer",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "senderAuthorityPda",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "tokenMessenger",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "messageSentEventData",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "messageTransmitterProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "tokenMessengerMinterProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "systemProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "ReplaceDepositForBurnParams"
          }
        }
      ],
      returns: "u64"
    },
    {
      name: "handleReceiveMessage",
      accounts: [
        {
          name: "authorityPda",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "tokenMessenger",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "remoteTokenMessenger",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "tokenMinter",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "localToken",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "tokenPair",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "recipientTokenAccount",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "custodyTokenAccount",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "tokenProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "HandleReceiveMessageParams"
          }
        }
      ]
    },
    {
      name: "setTokenController",
      accounts: [
        {
          name: "owner",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "tokenMessenger",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "tokenMinter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "SetTokenControllerParams"
          }
        }
      ]
    },
    {
      name: "pause",
      accounts: [
        {
          name: "pauser",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "tokenMinter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "PauseParams"
          }
        }
      ]
    },
    {
      name: "unpause",
      accounts: [
        {
          name: "pauser",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "tokenMinter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "UnpauseParams"
          }
        }
      ]
    },
    {
      name: "updatePauser",
      accounts: [
        {
          name: "owner",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "tokenMessenger",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "tokenMinter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "UpdatePauserParams"
          }
        }
      ]
    },
    {
      name: "setMaxBurnAmountPerMessage",
      accounts: [
        {
          name: "tokenController",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "tokenMinter",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "localToken",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "SetMaxBurnAmountPerMessageParams"
          }
        }
      ]
    },
    {
      name: "addLocalToken",
      accounts: [
        {
          name: "payer",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "tokenController",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "tokenMinter",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "localToken",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "custodyTokenAccount",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "localTokenMint",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "tokenProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "systemProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "AddLocalTokenParams"
          }
        }
      ]
    },
    {
      name: "removeLocalToken",
      accounts: [
        {
          name: "payee",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "tokenController",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "tokenMinter",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "localToken",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "custodyTokenAccount",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "tokenProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "RemoveLocalTokenParams"
          }
        }
      ]
    },
    {
      name: "linkTokenPair",
      accounts: [
        {
          name: "payer",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "tokenController",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "tokenMinter",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "tokenPair",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "systemProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "LinkTokenPairParams"
          }
        }
      ]
    },
    {
      name: "unlinkTokenPair",
      accounts: [
        {
          name: "payee",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "tokenController",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "tokenMinter",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "tokenPair",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "UninkTokenPairParams"
          }
        }
      ]
    },
    {
      name: "burnTokenCustody",
      accounts: [
        {
          name: "payee",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "tokenController",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "tokenMinter",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "localToken",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "custodyTokenAccount",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "custodyTokenMint",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "tokenProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "BurnTokenCustodyParams"
          }
        }
      ]
    }
  ],
  accounts: [
    {
      name: "tokenMessenger",
      type: {
        kind: "struct",
        fields: [
          {
            name: "owner",
            type: "publicKey"
          },
          {
            name: "pendingOwner",
            type: "publicKey"
          },
          {
            name: "localMessageTransmitter",
            type: "publicKey"
          },
          {
            name: "messageBodyVersion",
            type: "u32"
          },
          {
            name: "authorityBump",
            type: "u8"
          }
        ]
      }
    },
    {
      name: "remoteTokenMessenger",
      type: {
        kind: "struct",
        fields: [
          {
            name: "domain",
            type: "u32"
          },
          {
            name: "tokenMessenger",
            type: "publicKey"
          }
        ]
      }
    },
    {
      name: "tokenMinter",
      type: {
        kind: "struct",
        fields: [
          {
            name: "tokenController",
            type: "publicKey"
          },
          {
            name: "pauser",
            type: "publicKey"
          },
          {
            name: "paused",
            type: "bool"
          },
          {
            name: "bump",
            type: "u8"
          }
        ]
      }
    },
    {
      name: "tokenPair",
      type: {
        kind: "struct",
        fields: [
          {
            name: "remoteDomain",
            type: "u32"
          },
          {
            name: "remoteToken",
            type: "publicKey"
          },
          {
            name: "localToken",
            type: "publicKey"
          },
          {
            name: "bump",
            type: "u8"
          }
        ]
      }
    },
    {
      name: "localToken",
      type: {
        kind: "struct",
        fields: [
          {
            name: "custody",
            type: "publicKey"
          },
          {
            name: "mint",
            type: "publicKey"
          },
          {
            name: "burnLimitPerMessage",
            type: "u64"
          },
          {
            name: "messagesSent",
            type: "u64"
          },
          {
            name: "messagesReceived",
            type: "u64"
          },
          {
            name: "amountSent",
            type: "u128"
          },
          {
            name: "amountReceived",
            type: "u128"
          },
          {
            name: "bump",
            type: "u8"
          },
          {
            name: "custodyBump",
            type: "u8"
          }
        ]
      }
    }
  ],
  types: [
    {
      name: "AcceptOwnershipParams",
      type: {
        kind: "struct",
        fields: []
      }
    },
    {
      name: "AddRemoteTokenMessengerParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "domain",
            type: "u32"
          },
          {
            name: "tokenMessenger",
            type: "publicKey"
          }
        ]
      }
    },
    {
      name: "DepositForBurnWithCallerParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "amount",
            type: "u64"
          },
          {
            name: "destinationDomain",
            type: "u32"
          },
          {
            name: "mintRecipient",
            type: "publicKey"
          },
          {
            name: "destinationCaller",
            type: "publicKey"
          }
        ]
      }
    },
    {
      name: "DepositForBurnParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "amount",
            type: "u64"
          },
          {
            name: "destinationDomain",
            type: "u32"
          },
          {
            name: "mintRecipient",
            type: "publicKey"
          }
        ]
      }
    },
    {
      name: "HandleReceiveMessageParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "remoteDomain",
            type: "u32"
          },
          {
            name: "sender",
            type: "publicKey"
          },
          {
            name: "messageBody",
            type: "bytes"
          },
          {
            name: "authorityBump",
            type: "u8"
          }
        ]
      }
    },
    {
      name: "InitializeParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "tokenController",
            type: "publicKey"
          },
          {
            name: "localMessageTransmitter",
            type: "publicKey"
          },
          {
            name: "messageBodyVersion",
            type: "u32"
          }
        ]
      }
    },
    {
      name: "RemoveRemoteTokenMessengerParams",
      type: {
        kind: "struct",
        fields: []
      }
    },
    {
      name: "ReplaceDepositForBurnParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "originalMessage",
            type: "bytes"
          },
          {
            name: "originalAttestation",
            type: "bytes"
          },
          {
            name: "newDestinationCaller",
            type: "publicKey"
          },
          {
            name: "newMintRecipient",
            type: "publicKey"
          }
        ]
      }
    },
    {
      name: "TransferOwnershipParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "newOwner",
            type: "publicKey"
          }
        ]
      }
    },
    {
      name: "AddLocalTokenParams",
      type: {
        kind: "struct",
        fields: []
      }
    },
    {
      name: "BurnTokenCustodyParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "amount",
            type: "u64"
          }
        ]
      }
    },
    {
      name: "LinkTokenPairParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "localToken",
            type: "publicKey"
          },
          {
            name: "remoteDomain",
            type: "u32"
          },
          {
            name: "remoteToken",
            type: "publicKey"
          }
        ]
      }
    },
    {
      name: "PauseParams",
      type: {
        kind: "struct",
        fields: []
      }
    },
    {
      name: "RemoveLocalTokenParams",
      type: {
        kind: "struct",
        fields: []
      }
    },
    {
      name: "SetMaxBurnAmountPerMessageParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "burnLimitPerMessage",
            type: "u64"
          }
        ]
      }
    },
    {
      name: "SetTokenControllerParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "tokenController",
            type: "publicKey"
          }
        ]
      }
    },
    {
      name: "UninkTokenPairParams",
      type: {
        kind: "struct",
        fields: []
      }
    },
    {
      name: "UnpauseParams",
      type: {
        kind: "struct",
        fields: []
      }
    },
    {
      name: "UpdatePauserParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "newPauser",
            type: "publicKey"
          }
        ]
      }
    },
    {
      name: "TokenMinterError",
      type: {
        kind: "enum",
        variants: [
          {
            name: "InvalidAuthority"
          },
          {
            name: "InvalidTokenMinterState"
          },
          {
            name: "ProgramPaused"
          },
          {
            name: "InvalidTokenPairState"
          },
          {
            name: "InvalidLocalTokenState"
          },
          {
            name: "InvalidPauser"
          },
          {
            name: "InvalidTokenController"
          },
          {
            name: "BurnAmountExceeded"
          },
          {
            name: "InvalidAmount"
          }
        ]
      }
    }
  ],
  events: [
    {
      name: "OwnershipTransferStarted",
      fields: [
        {
          name: "previousOwner",
          type: "publicKey",
          index: !1
        },
        {
          name: "newOwner",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "OwnershipTransferred",
      fields: [
        {
          name: "previousOwner",
          type: "publicKey",
          index: !1
        },
        {
          name: "newOwner",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "DepositForBurn",
      fields: [
        {
          name: "nonce",
          type: "u64",
          index: !1
        },
        {
          name: "burnToken",
          type: "publicKey",
          index: !1
        },
        {
          name: "amount",
          type: "u64",
          index: !1
        },
        {
          name: "depositor",
          type: "publicKey",
          index: !1
        },
        {
          name: "mintRecipient",
          type: "publicKey",
          index: !1
        },
        {
          name: "destinationDomain",
          type: "u32",
          index: !1
        },
        {
          name: "destinationTokenMessenger",
          type: "publicKey",
          index: !1
        },
        {
          name: "destinationCaller",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "MintAndWithdraw",
      fields: [
        {
          name: "mintRecipient",
          type: "publicKey",
          index: !1
        },
        {
          name: "amount",
          type: "u64",
          index: !1
        },
        {
          name: "mintToken",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "RemoteTokenMessengerAdded",
      fields: [
        {
          name: "domain",
          type: "u32",
          index: !1
        },
        {
          name: "tokenMessenger",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "RemoteTokenMessengerRemoved",
      fields: [
        {
          name: "domain",
          type: "u32",
          index: !1
        },
        {
          name: "tokenMessenger",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "SetTokenController",
      fields: [
        {
          name: "tokenController",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "PauserChanged",
      fields: [
        {
          name: "newAddress",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "SetBurnLimitPerMessage",
      fields: [
        {
          name: "token",
          type: "publicKey",
          index: !1
        },
        {
          name: "burnLimitPerMessage",
          type: "u64",
          index: !1
        }
      ]
    },
    {
      name: "LocalTokenAdded",
      fields: [
        {
          name: "custody",
          type: "publicKey",
          index: !1
        },
        {
          name: "mint",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "LocalTokenRemoved",
      fields: [
        {
          name: "custody",
          type: "publicKey",
          index: !1
        },
        {
          name: "mint",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "TokenPairLinked",
      fields: [
        {
          name: "localToken",
          type: "publicKey",
          index: !1
        },
        {
          name: "remoteDomain",
          type: "u32",
          index: !1
        },
        {
          name: "remoteToken",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "TokenPairUnlinked",
      fields: [
        {
          name: "localToken",
          type: "publicKey",
          index: !1
        },
        {
          name: "remoteDomain",
          type: "u32",
          index: !1
        },
        {
          name: "remoteToken",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "Pause",
      fields: []
    },
    {
      name: "Unpause",
      fields: []
    },
    {
      name: "TokenCustodyBurned",
      fields: [
        {
          name: "custodyTokenAccount",
          type: "publicKey",
          index: !1
        },
        {
          name: "amount",
          type: "u64",
          index: !1
        }
      ]
    }
  ],
  errors: [
    {
      code: 6e3,
      name: "InvalidAuthority",
      msg: "Invalid authority"
    },
    {
      code: 6001,
      name: "InvalidTokenMessengerState",
      msg: "Invalid token messenger state"
    },
    {
      code: 6002,
      name: "InvalidTokenMessenger",
      msg: "Invalid token messenger"
    },
    {
      code: 6003,
      name: "InvalidOwner",
      msg: "Invalid owner"
    },
    {
      code: 6004,
      name: "MalformedMessage",
      msg: "Malformed message"
    },
    {
      code: 6005,
      name: "InvalidMessageBodyVersion",
      msg: "Invalid message body version"
    },
    {
      code: 6006,
      name: "InvalidAmount",
      msg: "Invalid amount"
    },
    {
      code: 6007,
      name: "InvalidDestinationDomain",
      msg: "Invalid destination domain"
    },
    {
      code: 6008,
      name: "InvalidDestinationCaller",
      msg: "Invalid destination caller"
    },
    {
      code: 6009,
      name: "InvalidMintRecipient",
      msg: "Invalid mint recipient"
    },
    {
      code: 6010,
      name: "InvalidSender",
      msg: "Invalid sender"
    },
    {
      code: 6011,
      name: "InvalidTokenPair",
      msg: "Invalid token pair"
    },
    {
      code: 6012,
      name: "InvalidTokenMint",
      msg: "Invalid token mint"
    }
  ]
}, Me = {
  version: "0.1.0",
  name: "message_transmitter",
  instructions: [
    {
      name: "initialize",
      accounts: [
        {
          name: "payer",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "upgradeAuthority",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "messageTransmitterProgramData",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "messageTransmitterProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "systemProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "InitializeParams"
          }
        }
      ]
    },
    {
      name: "transferOwnership",
      accounts: [
        {
          name: "owner",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "TransferOwnershipParams"
          }
        }
      ]
    },
    {
      name: "acceptOwnership",
      accounts: [
        {
          name: "pendingOwner",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "AcceptOwnershipParams"
          }
        }
      ]
    },
    {
      name: "updatePauser",
      accounts: [
        {
          name: "owner",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "UpdatePauserParams"
          }
        }
      ]
    },
    {
      name: "updateAttesterManager",
      accounts: [
        {
          name: "owner",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "UpdateAttesterManagerParams"
          }
        }
      ]
    },
    {
      name: "pause",
      accounts: [
        {
          name: "pauser",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "PauseParams"
          }
        }
      ]
    },
    {
      name: "unpause",
      accounts: [
        {
          name: "pauser",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "UnpauseParams"
          }
        }
      ]
    },
    {
      name: "setMaxMessageBodySize",
      accounts: [
        {
          name: "owner",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "SetMaxMessageBodySizeParams"
          }
        }
      ]
    },
    {
      name: "enableAttester",
      accounts: [
        {
          name: "payer",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "attesterManager",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "systemProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "EnableAttesterParams"
          }
        }
      ]
    },
    {
      name: "disableAttester",
      accounts: [
        {
          name: "payer",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "attesterManager",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "systemProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "DisableAttesterParams"
          }
        }
      ]
    },
    {
      name: "setSignatureThreshold",
      accounts: [
        {
          name: "attesterManager",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "SetSignatureThresholdParams"
          }
        }
      ]
    },
    {
      name: "sendMessage",
      accounts: [
        {
          name: "eventRentPayer",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "senderAuthorityPda",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "messageSentEventData",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "senderProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "systemProgram",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "SendMessageParams"
          }
        }
      ],
      returns: "u64"
    },
    {
      name: "sendMessageWithCaller",
      accounts: [
        {
          name: "eventRentPayer",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "senderAuthorityPda",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "messageSentEventData",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "senderProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "systemProgram",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "SendMessageWithCallerParams"
          }
        }
      ],
      returns: "u64"
    },
    {
      name: "replaceMessage",
      accounts: [
        {
          name: "eventRentPayer",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "senderAuthorityPda",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "messageSentEventData",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "senderProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "systemProgram",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "ReplaceMessageParams"
          }
        }
      ],
      returns: "u64"
    },
    {
      name: "receiveMessage",
      accounts: [
        {
          name: "payer",
          isMut: !0,
          isSigner: !0
        },
        {
          name: "caller",
          isMut: !1,
          isSigner: !0
        },
        {
          name: "authorityPda",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "messageTransmitter",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "usedNonces",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "receiver",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "systemProgram",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "eventAuthority",
          isMut: !1,
          isSigner: !1
        },
        {
          name: "program",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "ReceiveMessageParams"
          }
        }
      ]
    },
    {
      name: "reclaimEventAccount",
      accounts: [
        {
          name: "payee",
          isMut: !0,
          isSigner: !0,
          docs: ["rent SOL receiver, should match original rent payer"]
        },
        {
          name: "messageTransmitter",
          isMut: !0,
          isSigner: !1
        },
        {
          name: "messageSentEventData",
          isMut: !0,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "ReclaimEventAccountParams"
          }
        }
      ]
    },
    {
      name: "getNoncePda",
      accounts: [
        {
          name: "messageTransmitter",
          isMut: !1,
          isSigner: !1
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "GetNoncePDAParams"
          }
        }
      ],
      returns: "publicKey"
    },
    {
      name: "isNonceUsed",
      accounts: [
        {
          name: "usedNonces",
          isMut: !1,
          isSigner: !1,
          docs: [
            "Account will be explicitly loaded to avoid error when it's not initialized"
          ]
        }
      ],
      args: [
        {
          name: "params",
          type: {
            defined: "IsNonceUsedParams"
          }
        }
      ],
      returns: "bool"
    }
  ],
  accounts: [
    {
      name: "messageSent",
      type: {
        kind: "struct",
        fields: [
          {
            name: "rentPayer",
            type: "publicKey"
          },
          {
            name: "message",
            type: "bytes"
          }
        ]
      }
    },
    {
      name: "messageTransmitter",
      docs: ["Main state of the MessageTransmitter program"],
      type: {
        kind: "struct",
        fields: [
          {
            name: "owner",
            type: "publicKey"
          },
          {
            name: "pendingOwner",
            type: "publicKey"
          },
          {
            name: "attesterManager",
            type: "publicKey"
          },
          {
            name: "pauser",
            type: "publicKey"
          },
          {
            name: "paused",
            type: "bool"
          },
          {
            name: "localDomain",
            type: "u32"
          },
          {
            name: "version",
            type: "u32"
          },
          {
            name: "signatureThreshold",
            type: "u32"
          },
          {
            name: "enabledAttesters",
            type: {
              vec: "publicKey"
            }
          },
          {
            name: "maxMessageBodySize",
            type: "u64"
          },
          {
            name: "nextAvailableNonce",
            type: "u64"
          }
        ]
      }
    },
    {
      name: "usedNonces",
      docs: [
        "UsedNonces account holds an array of bits that indicate which nonces were already used",
        "so they can't be reused to receive new messages. Array starts with the first_nonce and",
        "holds flags for UsedNonces::MAX_NONCES. Nonces are recorded separately for each remote_domain."
      ],
      type: {
        kind: "struct",
        fields: [
          {
            name: "remoteDomain",
            type: "u32"
          },
          {
            name: "firstNonce",
            type: "u64"
          },
          {
            name: "usedNonces",
            type: {
              array: ["u64", 100]
            }
          }
        ]
      }
    }
  ],
  types: [
    {
      name: "AcceptOwnershipParams",
      type: {
        kind: "struct",
        fields: []
      }
    },
    {
      name: "DisableAttesterParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "attester",
            type: "publicKey"
          }
        ]
      }
    },
    {
      name: "EnableAttesterParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "newAttester",
            type: "publicKey"
          }
        ]
      }
    },
    {
      name: "GetNoncePDAParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "nonce",
            type: "u64"
          },
          {
            name: "sourceDomain",
            type: "u32"
          }
        ]
      }
    },
    {
      name: "InitializeParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "localDomain",
            type: "u32"
          },
          {
            name: "attester",
            type: "publicKey"
          },
          {
            name: "maxMessageBodySize",
            type: "u64"
          },
          {
            name: "version",
            type: "u32"
          }
        ]
      }
    },
    {
      name: "IsNonceUsedParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "nonce",
            type: "u64"
          }
        ]
      }
    },
    {
      name: "PauseParams",
      type: {
        kind: "struct",
        fields: []
      }
    },
    {
      name: "ReceiveMessageParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "message",
            type: "bytes"
          },
          {
            name: "attestation",
            type: "bytes"
          }
        ]
      }
    },
    {
      name: "HandleReceiveMessageParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "remoteDomain",
            type: "u32"
          },
          {
            name: "sender",
            type: "publicKey"
          },
          {
            name: "messageBody",
            type: "bytes"
          },
          {
            name: "authorityBump",
            type: "u8"
          }
        ]
      }
    },
    {
      name: "ReclaimEventAccountParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "attestation",
            type: "bytes"
          }
        ]
      }
    },
    {
      name: "ReplaceMessageParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "originalMessage",
            type: "bytes"
          },
          {
            name: "originalAttestation",
            type: "bytes"
          },
          {
            name: "newMessageBody",
            type: "bytes"
          },
          {
            name: "newDestinationCaller",
            type: "publicKey"
          }
        ]
      }
    },
    {
      name: "SendMessageWithCallerParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "destinationDomain",
            type: "u32"
          },
          {
            name: "recipient",
            type: "publicKey"
          },
          {
            name: "messageBody",
            type: "bytes"
          },
          {
            name: "destinationCaller",
            type: "publicKey"
          }
        ]
      }
    },
    {
      name: "SendMessageParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "destinationDomain",
            type: "u32"
          },
          {
            name: "recipient",
            type: "publicKey"
          },
          {
            name: "messageBody",
            type: "bytes"
          }
        ]
      }
    },
    {
      name: "SetMaxMessageBodySizeParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "newMaxMessageBodySize",
            type: "u64"
          }
        ]
      }
    },
    {
      name: "SetSignatureThresholdParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "newSignatureThreshold",
            type: "u32"
          }
        ]
      }
    },
    {
      name: "TransferOwnershipParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "newOwner",
            type: "publicKey"
          }
        ]
      }
    },
    {
      name: "UnpauseParams",
      type: {
        kind: "struct",
        fields: []
      }
    },
    {
      name: "UpdateAttesterManagerParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "newAttesterManager",
            type: "publicKey"
          }
        ]
      }
    },
    {
      name: "UpdatePauserParams",
      type: {
        kind: "struct",
        fields: [
          {
            name: "newPauser",
            type: "publicKey"
          }
        ]
      }
    },
    {
      name: "MathError",
      type: {
        kind: "enum",
        variants: [
          {
            name: "MathOverflow"
          },
          {
            name: "MathUnderflow"
          },
          {
            name: "ErrorInDivision"
          }
        ]
      }
    }
  ],
  events: [
    {
      name: "OwnershipTransferStarted",
      fields: [
        {
          name: "previousOwner",
          type: "publicKey",
          index: !1
        },
        {
          name: "newOwner",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "OwnershipTransferred",
      fields: [
        {
          name: "previousOwner",
          type: "publicKey",
          index: !1
        },
        {
          name: "newOwner",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "PauserChanged",
      fields: [
        {
          name: "newAddress",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "AttesterManagerUpdated",
      fields: [
        {
          name: "previousAttesterManager",
          type: "publicKey",
          index: !1
        },
        {
          name: "newAttesterManager",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "MessageReceived",
      fields: [
        {
          name: "caller",
          type: "publicKey",
          index: !1
        },
        {
          name: "sourceDomain",
          type: "u32",
          index: !1
        },
        {
          name: "nonce",
          type: "u64",
          index: !1
        },
        {
          name: "sender",
          type: "publicKey",
          index: !1
        },
        {
          name: "messageBody",
          type: "bytes",
          index: !1
        }
      ]
    },
    {
      name: "SignatureThresholdUpdated",
      fields: [
        {
          name: "oldSignatureThreshold",
          type: "u32",
          index: !1
        },
        {
          name: "newSignatureThreshold",
          type: "u32",
          index: !1
        }
      ]
    },
    {
      name: "AttesterEnabled",
      fields: [
        {
          name: "attester",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "AttesterDisabled",
      fields: [
        {
          name: "attester",
          type: "publicKey",
          index: !1
        }
      ]
    },
    {
      name: "MaxMessageBodySizeUpdated",
      fields: [
        {
          name: "newMaxMessageBodySize",
          type: "u64",
          index: !1
        }
      ]
    },
    {
      name: "Pause",
      fields: []
    },
    {
      name: "Unpause",
      fields: []
    }
  ],
  errors: [
    {
      code: 6e3,
      name: "InvalidAuthority",
      msg: "Invalid authority"
    },
    {
      code: 6001,
      name: "ProgramPaused",
      msg: "Instruction is not allowed at this time"
    },
    {
      code: 6002,
      name: "InvalidMessageTransmitterState",
      msg: "Invalid message transmitter state"
    },
    {
      code: 6003,
      name: "InvalidSignatureThreshold",
      msg: "Invalid signature threshold"
    },
    {
      code: 6004,
      name: "SignatureThresholdAlreadySet",
      msg: "Signature threshold already set"
    },
    {
      code: 6005,
      name: "InvalidOwner",
      msg: "Invalid owner"
    },
    {
      code: 6006,
      name: "InvalidPauser",
      msg: "Invalid pauser"
    },
    {
      code: 6007,
      name: "InvalidAttesterManager",
      msg: "Invalid attester manager"
    },
    {
      code: 6008,
      name: "InvalidAttester",
      msg: "Invalid attester"
    },
    {
      code: 6009,
      name: "AttesterAlreadyEnabled",
      msg: "Attester already enabled"
    },
    {
      code: 6010,
      name: "TooFewEnabledAttesters",
      msg: "Too few enabled attesters"
    },
    {
      code: 6011,
      name: "SignatureThresholdTooLow",
      msg: "Signature threshold is too low"
    },
    {
      code: 6012,
      name: "AttesterAlreadyDisabled",
      msg: "Attester already disabled"
    },
    {
      code: 6013,
      name: "MessageBodyLimitExceeded",
      msg: "Message body exceeds max size"
    },
    {
      code: 6014,
      name: "InvalidDestinationCaller",
      msg: "Invalid destination caller"
    },
    {
      code: 6015,
      name: "InvalidRecipient",
      msg: "Invalid message recipient"
    },
    {
      code: 6016,
      name: "SenderNotPermitted",
      msg: "Sender is not permitted"
    },
    {
      code: 6017,
      name: "InvalidSourceDomain",
      msg: "Invalid source domain"
    },
    {
      code: 6018,
      name: "InvalidDestinationDomain",
      msg: "Invalid destination domain"
    },
    {
      code: 6019,
      name: "InvalidMessageVersion",
      msg: "Invalid message version"
    },
    {
      code: 6020,
      name: "InvalidUsedNoncesAccount",
      msg: "Invalid used nonces account"
    },
    {
      code: 6021,
      name: "InvalidRecipientProgram",
      msg: "Invalid recipient program"
    },
    {
      code: 6022,
      name: "InvalidNonce",
      msg: "Invalid nonce"
    },
    {
      code: 6023,
      name: "NonceAlreadyUsed",
      msg: "Nonce already used"
    },
    {
      code: 6024,
      name: "MessageTooShort",
      msg: "Message is too short"
    },
    {
      code: 6025,
      name: "MalformedMessage",
      msg: "Malformed message"
    },
    {
      code: 6026,
      name: "InvalidSignatureOrderOrDupe",
      msg: "Invalid signature order or dupe"
    },
    {
      code: 6027,
      name: "InvalidAttesterSignature",
      msg: "Invalid attester signature"
    },
    {
      code: 6028,
      name: "InvalidAttestationLength",
      msg: "Invalid attestation length"
    },
    {
      code: 6029,
      name: "InvalidSignatureRecoveryId",
      msg: "Invalid signature recovery ID"
    },
    {
      code: 6030,
      name: "InvalidSignatureSValue",
      msg: "Invalid signature S value"
    },
    {
      code: 6031,
      name: "InvalidMessageHash",
      msg: "Invalid message hash"
    }
  ]
};
ae(ee, "CircleBridge", w);
const F = {
  TokenMessengerIdl: ye,
  MessageTransmitterIdl: Me
};
export {
  w as SolanaCircleBridge,
  W as calculateFirstNonce,
  fe as createDepositForBurnInstruction,
  L as createMessageTransmitterProgramInterface,
  ge as createReadOnlyMessageTransmitterProgramInterface,
  ce as createReadOnlyTokenMessengerProgramInterface,
  pe as createReceiveMessageInstruction,
  U as createTokenMessengerProgramInterface,
  m as findProgramAddress,
  F as idl,
  z as nonceAccount
};
