@quirks/store
Version:
2 lines (1 loc) • 3.73 kB
JavaScript
;var b=Object.create;var P=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var G=(n,t,g,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of _(t))!F.call(n,s)&&s!==g&&P(n,s,{get:()=>t[s],enumerable:!(i=v(t,s))||i.enumerable});return n};var m=(n,t,g)=>(g=n!=null?b(q(n)):{},G(t||!n||!n.__esModule?P(g,"default",{value:n,enumerable:!0}):g,n));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@quirks/core"),u=require("./index7.cjs");function E(n,t,g="auto"){const i=n.getState();switch(e.assertIsDefined(i.wallet,"wallet is undefined"),g){case"auto":return i.wallet.getOfflineSignerAuto(t,i.signOptions);case"amino":return i.wallet.getOfflineSignerOnlyAmino(t,i.signOptions);case"direct":return i.wallet.getOfflineSigner(t,i.signOptions)}}async function j(n,t,g,i="auto",s="auto",r,p,c,f=1.4,d){var I;const a=n.getState();e.assertIsDefined(a.wallet,"wallet is undefined");const o=typeof t=="string"?u.getChain(n,t):t;e.assertIsDefined(o);const S=typeof t=="string"?e.getEndpoint(t,a.chains):e.getEndpoint(t),C=typeof t=="string"?u.getAddress(n,t):d;e.assertIsDefined(C);const A=await E(n,o.chain_id,s);let l;const y=(I=a.signerOptions)==null?void 0:I.signingStargate;y&&(l=await y(o));const W=await import("@cosmjs/stargate"),D=await(W.SigningStargateClient??W.default.SigningStargateClient).connectWithSigner(S.rpc.address,A,l);if(i==="auto"){let w=l==null?void 0:l.gasPrice;w||(w=await e.getGasPrice(o)),i=await e.estimateFee(D,C,g,w,r,f)}return e.openWCDeeplink(a.wallet,a.openDeeplink),D.sign(C,g,i,r??"",p,c)}async function M(n,t,g,i="auto",s="auto",r,p,c,f=1.4,d){var I;const a=n.getState();e.assertIsDefined(a.wallet);const o=typeof t=="string"?u.getChain(n,t):t;e.assertIsDefined(o);const S=typeof t=="string"?e.getEndpoint(t,a.chains):e.getEndpoint(t),C=typeof t=="string"?u.getAddress(n,t):d;e.assertIsDefined(C);const A=await E(n,o.chain_id,s);let l;const y=(I=a.signerOptions)==null?void 0:I.signingCosmwasm;y&&(l=await y(o));const W=await import("@cosmjs/cosmwasm-stargate"),D=await(W.SigningCosmWasmClient??W.default.SigningCosmWasmClient).connectWithSigner(S.rpc.address,A,l);if(i==="auto"){let w=l==null?void 0:l.gasPrice;w||(w=await e.getGasPrice(o)),i=await e.estimateFee(D,C,g,w,r,f)}return e.openWCDeeplink(a.wallet,a.openDeeplink),D.sign(C,g,i,r??"",p,c)}function T(n,t,g,i){const s=n.getState();return e.assertIsDefined(s.wallet),e.openWCDeeplink(s.wallet,s.openDeeplink),s.wallet.signArbitrary(t,g,i)}async function x(n,t,g="auto"){var S;const i=n.getState();e.assertIsDefined(i.wallet,"wallet is undefined");const s=typeof t=="string"?u.getChain(n,t):t;e.assertIsDefined(s);const r=typeof t=="string"?e.getEndpoint(t,i.chains):e.getEndpoint(t),p=await E(n,s.chain_id,g);let c;const f=(S=i.signerOptions)==null?void 0:S.signingStargate;f&&(c=await f(s));const d=await import("@cosmjs/stargate");return await(d.SigningStargateClient??d.default.SigningStargateClient).connectWithSigner(r.rpc.address,p,c)}async function z(n,t,g="auto"){var S;const i=n.getState();e.assertIsDefined(i.wallet);const s=typeof t=="string"?u.getChain(n,t):t;e.assertIsDefined(s);const r=typeof t=="string"?e.getEndpoint(t,i.chains):e.getEndpoint(t),p=await E(n,s.chain_id,g);let c;const f=(S=i.signerOptions)==null?void 0:S.signingCosmwasm;f&&(c=await f(s));const d=await import("@cosmjs/cosmwasm-stargate");return await(d.SigningCosmWasmClient??d.default.SigningCosmWasmClient).connectWithSigner(r.rpc.address,p,c)}exports.getOfflineSigner=E;exports.getSigningCosmWasmClient=z;exports.getSigningStargateClient=x;exports.sign=j;exports.signArbitrary=T;exports.signCW=M;