UNPKG

@quirks/store

Version:
35 lines (34 loc) 1.29 kB
import { assertIsDefined as T, getEndpoint as p } from "@quirks/core"; import { getChain as y } from "./index7.js"; async function b(n, t, d, e = 6e4, o = 3e3) { var S; const i = n.getState(), s = typeof t == "string" ? y(n, t) : t; T(s); const c = typeof t == "string" ? p(t, i.chains) : p(t); let a; const l = (S = i.signerOptions) == null ? void 0 : S.stargate; l && (a = await l(s)); const r = await import("@cosmjs/stargate"), x = await (r.StargateClient ?? r.default.StargateClient).connect( c.rpc.address, a ), g = await import("cosmjs-types/cosmos/tx/v1beta1/tx"), C = (g.TxRaw ?? g.default.TxRaw).encode(d).finish(); return x.broadcastTx(C, e, o); } async function j(n, t, d) { var w; const e = n.getState(), o = typeof t == "string" ? y(n, t) : t; T(o); const i = typeof t == "string" ? p(t, e.chains) : p(t); let s; const c = (w = e.signerOptions) == null ? void 0 : w.stargate; c && (s = await c(o)); const a = await import("@cosmjs/stargate"), r = await (a.StargateClient ?? a.default.StargateClient).connect( i.rpc.address, s ), f = await import("cosmjs-types/cosmos/tx/v1beta1/tx"), g = (f.TxRaw ?? f.default.TxRaw).encode(d).finish(); return r.broadcastTxSync(g); } export { b as broadcast, j as broadcastSync };