UNPKG

@quirks/store

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