@magic-ext/cosmos 23.9.0 → 23.9.1-canary.045fe98.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var d=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var S=(r,s)=>{for(var n in s)d(r,n,{get:s[n],enumerable:!0})},f=(r,s,n,e)=>{if(s&&typeof s=="object"||typeof s=="function")for(let i of y(s))!A.call(r,i)&&i!==n&&d(r,i,{get:()=>s[i],enumerable:!(e=h(s,i))||e.enumerable});return r};var l=r=>f(d({},"__esModule",{value:!0}),r);var t=(r,s,n)=>new Promise((e,i)=>{var a=c=>{try{o(n.next(c))}catch(p){i(p)}},m=c=>{try{o(n.throw(c))}catch(p){i(p)}},o=c=>c.done?e(c.value):Promise.resolve(c.value).then(a,m);o((n=n.apply(r,s)).next())});var b={};S(b,{CosmosExtension:()=>g});module.exports=l(b);var u=require("@magic-sdk/commons");var g=class extends u.Extension.Internal{constructor(n){super();this.cosmosConfig=n;this.name="cosmos";this.config={};this.signAndBroadcast=(n,e)=>t(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_signAndBroadcast",params:{message:n,fee:e}})});this.sign=(n,e)=>t(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sign",params:{message:n,fee:e}})});this.sendTokens=(n,e,i,a)=>t(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sendTokens",params:{recipientAddress:n,transferAmount:e,denom:i,memo:a}})});this.changeAddress=n=>t(this,null,function*(){return this.request({id:41,jsonrpc:"2.0",method:"cos_changeAddress",params:{prefix:n}})});this.config={rpcUrl:n.rpcUrl,chainType:"COSMOS",options:{chain:n.chain}}}};
1
+ "use strict";var g=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var T=(r,s)=>{for(var n in s)g(r,n,{get:s[n],enumerable:!0})},A=(r,s,n,e)=>{if(s&&typeof s=="object"||typeof s=="function")for(let i of y(s))!S.call(r,i)&&i!==n&&g(r,i,{get:()=>s[i],enumerable:!(e=h(s,i))||e.enumerable});return r};var b=r=>A(g({},"__esModule",{value:!0}),r);var a=(r,s,n)=>new Promise((e,i)=>{var c=t=>{try{p(n.next(t))}catch(o){i(o)}},m=t=>{try{p(n.throw(t))}catch(o){i(o)}},p=t=>t.done?e(t.value):Promise.resolve(t.value).then(c,m);p((n=n.apply(r,s)).next())});var f={};T(f,{CosmosExtension:()=>d});module.exports=b(f);var u=require("@magic-sdk/commons");var d=class extends u.Extension.Internal{constructor(n){super();this.cosmosConfig=n;this.name="cosmos";this.config={};this.signAndBroadcast=(n,e)=>a(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_signAndBroadcast",params:{message:n,fee:e}})});this.sign=(n,e)=>a(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sign",params:{message:n,fee:e}})});this.signTypedData=n=>this.request({id:42,jsonrpc:"2.0",method:"cos_signTypedData",params:{message:n}});this.sendTokens=(n,e,i,c)=>a(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sendTokens",params:{recipientAddress:n,transferAmount:e,denom:i,memo:c}})});this.changeAddress=n=>a(this,null,function*(){return this.request({id:41,jsonrpc:"2.0",method:"cos_changeAddress",params:{prefix:n}})});this.config={rpcUrl:n.rpcUrl,chainType:"COSMOS",options:{chain:n.chain}}}};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["import { Extension } from '@magic-sdk/commons';\nimport { CosmosConfig, CosmosPayloadMethod } from './type';\n\nexport class CosmosExtension extends Extension.Internal<'cosmos', any> {\n name = 'cosmos' as const;\n config: any = {};\n\n constructor(public cosmosConfig: CosmosConfig) {\n super();\n\n this.config = {\n rpcUrl: cosmosConfig.rpcUrl,\n chainType: 'COSMOS',\n options: {\n chain: cosmosConfig.chain,\n },\n };\n }\n\n public signAndBroadcast = async (message: any, fee: any) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.SignAndBroadcast,\n params: { message, fee },\n });\n };\n\n public sign = async (message: any, fee: any) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.Sign,\n params: { message, fee },\n });\n };\n\n public sendTokens = async (\n recipientAddress: string,\n transferAmount: string | number,\n denom: string,\n memo?: string,\n ) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.SendTokens,\n params: { recipientAddress, transferAmount, denom, memo },\n });\n };\n\n public changeAddress = async (prefix: string) => {\n return this.request({\n id: 41,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.ChangeAddress,\n params: { prefix },\n });\n };\n}\n"],
5
- "mappings": "snBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA0B,8BAGnB,IAAMC,EAAN,cAA8B,YAAU,QAAwB,CAIrE,YAAmBC,EAA4B,CAC7C,MAAM,EADW,kBAAAA,EAHnB,UAAO,SACP,YAAc,CAAC,EAcf,KAAO,iBAAmB,CAAOC,EAAcC,IAAaC,EAAA,sBAC1D,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,8BACA,OAAQ,CAAE,QAAAF,EAAS,IAAAC,CAAI,CACzB,CAAC,CACH,GAEA,KAAO,KAAO,CAAOD,EAAcC,IAAaC,EAAA,sBAC9C,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,kBACA,OAAQ,CAAE,QAAAF,EAAS,IAAAC,CAAI,CACzB,CAAC,CACH,GAEA,KAAO,WAAa,CAClBE,EACAC,EACAC,EACAC,IACGJ,EAAA,sBACH,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,wBACA,OAAQ,CAAE,iBAAAC,EAAkB,eAAAC,EAAgB,MAAAC,EAAO,KAAAC,CAAK,CAC1D,CAAC,CACH,GAEA,KAAO,cAAuBC,GAAmBL,EAAA,sBAC/C,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,2BACA,OAAQ,CAAE,OAAAK,CAAO,CACnB,CAAC,CACH,GAhDE,KAAK,OAAS,CACZ,OAAQR,EAAa,OACrB,UAAW,SACX,QAAS,CACP,MAAOA,EAAa,KACtB,CACF,CACF,CA0CF",
4
+ "sourcesContent": ["import { Extension } from '@magic-sdk/commons';\nimport { CosmosConfig, CosmosPayloadMethod } from './type';\n\nexport class CosmosExtension extends Extension.Internal<'cosmos', any> {\n name = 'cosmos' as const;\n config: any = {};\n\n constructor(public cosmosConfig: CosmosConfig) {\n super();\n\n this.config = {\n rpcUrl: cosmosConfig.rpcUrl,\n chainType: 'COSMOS',\n options: {\n chain: cosmosConfig.chain,\n },\n };\n }\n\n public signAndBroadcast = async (message: any, fee: any) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.SignAndBroadcast,\n params: { message, fee },\n });\n };\n\n public sign = async (message: any, fee: any) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.Sign,\n params: { message, fee },\n });\n };\n\n public signTypedData = (message: string) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.SignTypedData,\n params: { message },\n });\n };\n\n public sendTokens = async (\n recipientAddress: string,\n transferAmount: string | number,\n denom: string,\n memo?: string,\n ) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.SendTokens,\n params: { recipientAddress, transferAmount, denom, memo },\n });\n };\n\n public changeAddress = async (prefix: string) => {\n return this.request({\n id: 41,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.ChangeAddress,\n params: { prefix },\n });\n };\n}\n"],
5
+ "mappings": "snBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA0B,8BAGnB,IAAMC,EAAN,cAA8B,YAAU,QAAwB,CAIrE,YAAmBC,EAA4B,CAC7C,MAAM,EADW,kBAAAA,EAHnB,UAAO,SACP,YAAc,CAAC,EAcf,KAAO,iBAAmB,CAAOC,EAAcC,IAAaC,EAAA,sBAC1D,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,8BACA,OAAQ,CAAE,QAAAF,EAAS,IAAAC,CAAI,CACzB,CAAC,CACH,GAEA,KAAO,KAAO,CAAOD,EAAcC,IAAaC,EAAA,sBAC9C,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,kBACA,OAAQ,CAAE,QAAAF,EAAS,IAAAC,CAAI,CACzB,CAAC,CACH,GAEA,KAAO,cAAiBD,GACf,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,2BACA,OAAQ,CAAE,QAAAA,CAAQ,CACpB,CAAC,EAGH,KAAO,WAAa,CAClBG,EACAC,EACAC,EACAC,IACGJ,EAAA,sBACH,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,wBACA,OAAQ,CAAE,iBAAAC,EAAkB,eAAAC,EAAgB,MAAAC,EAAO,KAAAC,CAAK,CAC1D,CAAC,CACH,GAEA,KAAO,cAAuBC,GAAmBL,EAAA,sBAC/C,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,2BACA,OAAQ,CAAE,OAAAK,CAAO,CACnB,CAAC,CACH,GAzDE,KAAK,OAAS,CACZ,OAAQR,EAAa,OACrB,UAAW,SACX,QAAS,CACP,MAAOA,EAAa,KACtB,CACF,CACF,CAmDF",
6
6
  "names": ["src_exports", "__export", "CosmosExtension", "__toCommonJS", "import_commons", "CosmosExtension", "cosmosConfig", "message", "fee", "__async", "recipientAddress", "transferAmount", "denom", "memo", "prefix"]
7
7
  }
package/dist/es/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var e=(o,p,n)=>new Promise((s,i)=>{var c=r=>{try{t(n.next(r))}catch(a){i(a)}},g=r=>{try{t(n.throw(r))}catch(a){i(a)}},t=r=>r.done?s(r.value):Promise.resolve(r.value).then(c,g);t((n=n.apply(o,p)).next())});import{Extension as u}from"@magic-sdk/commons";var d=class extends u.Internal{constructor(n){super();this.cosmosConfig=n;this.name="cosmos";this.config={};this.signAndBroadcast=(n,s)=>e(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_signAndBroadcast",params:{message:n,fee:s}})});this.sign=(n,s)=>e(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sign",params:{message:n,fee:s}})});this.sendTokens=(n,s,i,c)=>e(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sendTokens",params:{recipientAddress:n,transferAmount:s,denom:i,memo:c}})});this.changeAddress=n=>e(this,null,function*(){return this.request({id:41,jsonrpc:"2.0",method:"cos_changeAddress",params:{prefix:n}})});this.config={rpcUrl:n.rpcUrl,chainType:"COSMOS",options:{chain:n.chain}}}};export{d as CosmosExtension};
1
+ var e=(p,o,n)=>new Promise((s,i)=>{var t=r=>{try{a(n.next(r))}catch(c){i(c)}},d=r=>{try{a(n.throw(r))}catch(c){i(c)}},a=r=>r.done?s(r.value):Promise.resolve(r.value).then(t,d);a((n=n.apply(p,o)).next())});import{Extension as u}from"@magic-sdk/commons";var g=class extends u.Internal{constructor(n){super();this.cosmosConfig=n;this.name="cosmos";this.config={};this.signAndBroadcast=(n,s)=>e(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_signAndBroadcast",params:{message:n,fee:s}})});this.sign=(n,s)=>e(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sign",params:{message:n,fee:s}})});this.signTypedData=n=>this.request({id:42,jsonrpc:"2.0",method:"cos_signTypedData",params:{message:n}});this.sendTokens=(n,s,i,t)=>e(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sendTokens",params:{recipientAddress:n,transferAmount:s,denom:i,memo:t}})});this.changeAddress=n=>e(this,null,function*(){return this.request({id:41,jsonrpc:"2.0",method:"cos_changeAddress",params:{prefix:n}})});this.config={rpcUrl:n.rpcUrl,chainType:"COSMOS",options:{chain:n.chain}}}};export{g as CosmosExtension};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["import { Extension } from '@magic-sdk/commons';\nimport { CosmosConfig, CosmosPayloadMethod } from './type';\n\nexport class CosmosExtension extends Extension.Internal<'cosmos', any> {\n name = 'cosmos' as const;\n config: any = {};\n\n constructor(public cosmosConfig: CosmosConfig) {\n super();\n\n this.config = {\n rpcUrl: cosmosConfig.rpcUrl,\n chainType: 'COSMOS',\n options: {\n chain: cosmosConfig.chain,\n },\n };\n }\n\n public signAndBroadcast = async (message: any, fee: any) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.SignAndBroadcast,\n params: { message, fee },\n });\n };\n\n public sign = async (message: any, fee: any) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.Sign,\n params: { message, fee },\n });\n };\n\n public sendTokens = async (\n recipientAddress: string,\n transferAmount: string | number,\n denom: string,\n memo?: string,\n ) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.SendTokens,\n params: { recipientAddress, transferAmount, denom, memo },\n });\n };\n\n public changeAddress = async (prefix: string) => {\n return this.request({\n id: 41,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.ChangeAddress,\n params: { prefix },\n });\n };\n}\n"],
5
- "mappings": "6MAAA,OAAS,aAAAA,MAAiB,qBAGnB,IAAMC,EAAN,cAA8BC,EAAU,QAAwB,CAIrE,YAAmBC,EAA4B,CAC7C,MAAM,EADW,kBAAAA,EAHnB,UAAO,SACP,YAAc,CAAC,EAcf,KAAO,iBAAmB,CAAOC,EAAcC,IAAaC,EAAA,sBAC1D,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,8BACA,OAAQ,CAAE,QAAAF,EAAS,IAAAC,CAAI,CACzB,CAAC,CACH,GAEA,KAAO,KAAO,CAAOD,EAAcC,IAAaC,EAAA,sBAC9C,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,kBACA,OAAQ,CAAE,QAAAF,EAAS,IAAAC,CAAI,CACzB,CAAC,CACH,GAEA,KAAO,WAAa,CAClBE,EACAC,EACAC,EACAC,IACGJ,EAAA,sBACH,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,wBACA,OAAQ,CAAE,iBAAAC,EAAkB,eAAAC,EAAgB,MAAAC,EAAO,KAAAC,CAAK,CAC1D,CAAC,CACH,GAEA,KAAO,cAAuBC,GAAmBL,EAAA,sBAC/C,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,2BACA,OAAQ,CAAE,OAAAK,CAAO,CACnB,CAAC,CACH,GAhDE,KAAK,OAAS,CACZ,OAAQR,EAAa,OACrB,UAAW,SACX,QAAS,CACP,MAAOA,EAAa,KACtB,CACF,CACF,CA0CF",
4
+ "sourcesContent": ["import { Extension } from '@magic-sdk/commons';\nimport { CosmosConfig, CosmosPayloadMethod } from './type';\n\nexport class CosmosExtension extends Extension.Internal<'cosmos', any> {\n name = 'cosmos' as const;\n config: any = {};\n\n constructor(public cosmosConfig: CosmosConfig) {\n super();\n\n this.config = {\n rpcUrl: cosmosConfig.rpcUrl,\n chainType: 'COSMOS',\n options: {\n chain: cosmosConfig.chain,\n },\n };\n }\n\n public signAndBroadcast = async (message: any, fee: any) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.SignAndBroadcast,\n params: { message, fee },\n });\n };\n\n public sign = async (message: any, fee: any) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.Sign,\n params: { message, fee },\n });\n };\n\n public signTypedData = (message: string) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.SignTypedData,\n params: { message },\n });\n };\n\n public sendTokens = async (\n recipientAddress: string,\n transferAmount: string | number,\n denom: string,\n memo?: string,\n ) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.SendTokens,\n params: { recipientAddress, transferAmount, denom, memo },\n });\n };\n\n public changeAddress = async (prefix: string) => {\n return this.request({\n id: 41,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.ChangeAddress,\n params: { prefix },\n });\n };\n}\n"],
5
+ "mappings": "6MAAA,OAAS,aAAAA,MAAiB,qBAGnB,IAAMC,EAAN,cAA8BC,EAAU,QAAwB,CAIrE,YAAmBC,EAA4B,CAC7C,MAAM,EADW,kBAAAA,EAHnB,UAAO,SACP,YAAc,CAAC,EAcf,KAAO,iBAAmB,CAAOC,EAAcC,IAAaC,EAAA,sBAC1D,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,8BACA,OAAQ,CAAE,QAAAF,EAAS,IAAAC,CAAI,CACzB,CAAC,CACH,GAEA,KAAO,KAAO,CAAOD,EAAcC,IAAaC,EAAA,sBAC9C,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,kBACA,OAAQ,CAAE,QAAAF,EAAS,IAAAC,CAAI,CACzB,CAAC,CACH,GAEA,KAAO,cAAiBD,GACf,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,2BACA,OAAQ,CAAE,QAAAA,CAAQ,CACpB,CAAC,EAGH,KAAO,WAAa,CAClBG,EACAC,EACAC,EACAC,IACGJ,EAAA,sBACH,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,wBACA,OAAQ,CAAE,iBAAAC,EAAkB,eAAAC,EAAgB,MAAAC,EAAO,KAAAC,CAAK,CAC1D,CAAC,CACH,GAEA,KAAO,cAAuBC,GAAmBL,EAAA,sBAC/C,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,2BACA,OAAQ,CAAE,OAAAK,CAAO,CACnB,CAAC,CACH,GAzDE,KAAK,OAAS,CACZ,OAAQR,EAAa,OACrB,UAAW,SACX,QAAS,CACP,MAAOA,EAAa,KACtB,CACF,CACF,CAmDF",
6
6
  "names": ["Extension", "CosmosExtension", "Extension", "cosmosConfig", "message", "fee", "__async", "recipientAddress", "transferAmount", "denom", "memo", "prefix"]
7
7
  }
package/dist/es/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- var e=(o,p,n)=>new Promise((s,i)=>{var c=r=>{try{t(n.next(r))}catch(a){i(a)}},g=r=>{try{t(n.throw(r))}catch(a){i(a)}},t=r=>r.done?s(r.value):Promise.resolve(r.value).then(c,g);t((n=n.apply(o,p)).next())});import{Extension as u}from"@magic-sdk/commons";var d=class extends u.Internal{constructor(n){super();this.cosmosConfig=n;this.name="cosmos";this.config={};this.signAndBroadcast=(n,s)=>e(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_signAndBroadcast",params:{message:n,fee:s}})});this.sign=(n,s)=>e(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sign",params:{message:n,fee:s}})});this.sendTokens=(n,s,i,c)=>e(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sendTokens",params:{recipientAddress:n,transferAmount:s,denom:i,memo:c}})});this.changeAddress=n=>e(this,null,function*(){return this.request({id:41,jsonrpc:"2.0",method:"cos_changeAddress",params:{prefix:n}})});this.config={rpcUrl:n.rpcUrl,chainType:"COSMOS",options:{chain:n.chain}}}};export{d as CosmosExtension};
1
+ var e=(p,o,n)=>new Promise((s,i)=>{var t=r=>{try{a(n.next(r))}catch(c){i(c)}},d=r=>{try{a(n.throw(r))}catch(c){i(c)}},a=r=>r.done?s(r.value):Promise.resolve(r.value).then(t,d);a((n=n.apply(p,o)).next())});import{Extension as u}from"@magic-sdk/commons";var g=class extends u.Internal{constructor(n){super();this.cosmosConfig=n;this.name="cosmos";this.config={};this.signAndBroadcast=(n,s)=>e(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_signAndBroadcast",params:{message:n,fee:s}})});this.sign=(n,s)=>e(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sign",params:{message:n,fee:s}})});this.signTypedData=n=>this.request({id:42,jsonrpc:"2.0",method:"cos_signTypedData",params:{message:n}});this.sendTokens=(n,s,i,t)=>e(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sendTokens",params:{recipientAddress:n,transferAmount:s,denom:i,memo:t}})});this.changeAddress=n=>e(this,null,function*(){return this.request({id:41,jsonrpc:"2.0",method:"cos_changeAddress",params:{prefix:n}})});this.config={rpcUrl:n.rpcUrl,chainType:"COSMOS",options:{chain:n.chain}}}};export{g as CosmosExtension};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["import { Extension } from '@magic-sdk/commons';\nimport { CosmosConfig, CosmosPayloadMethod } from './type';\n\nexport class CosmosExtension extends Extension.Internal<'cosmos', any> {\n name = 'cosmos' as const;\n config: any = {};\n\n constructor(public cosmosConfig: CosmosConfig) {\n super();\n\n this.config = {\n rpcUrl: cosmosConfig.rpcUrl,\n chainType: 'COSMOS',\n options: {\n chain: cosmosConfig.chain,\n },\n };\n }\n\n public signAndBroadcast = async (message: any, fee: any) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.SignAndBroadcast,\n params: { message, fee },\n });\n };\n\n public sign = async (message: any, fee: any) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.Sign,\n params: { message, fee },\n });\n };\n\n public sendTokens = async (\n recipientAddress: string,\n transferAmount: string | number,\n denom: string,\n memo?: string,\n ) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.SendTokens,\n params: { recipientAddress, transferAmount, denom, memo },\n });\n };\n\n public changeAddress = async (prefix: string) => {\n return this.request({\n id: 41,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.ChangeAddress,\n params: { prefix },\n });\n };\n}\n"],
5
- "mappings": "6MAAA,OAAS,aAAAA,MAAiB,qBAGnB,IAAMC,EAAN,cAA8BC,EAAU,QAAwB,CAIrE,YAAmBC,EAA4B,CAC7C,MAAM,EADW,kBAAAA,EAHnB,UAAO,SACP,YAAc,CAAC,EAcf,KAAO,iBAAmB,CAAOC,EAAcC,IAAaC,EAAA,sBAC1D,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,8BACA,OAAQ,CAAE,QAAAF,EAAS,IAAAC,CAAI,CACzB,CAAC,CACH,GAEA,KAAO,KAAO,CAAOD,EAAcC,IAAaC,EAAA,sBAC9C,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,kBACA,OAAQ,CAAE,QAAAF,EAAS,IAAAC,CAAI,CACzB,CAAC,CACH,GAEA,KAAO,WAAa,CAClBE,EACAC,EACAC,EACAC,IACGJ,EAAA,sBACH,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,wBACA,OAAQ,CAAE,iBAAAC,EAAkB,eAAAC,EAAgB,MAAAC,EAAO,KAAAC,CAAK,CAC1D,CAAC,CACH,GAEA,KAAO,cAAuBC,GAAmBL,EAAA,sBAC/C,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,2BACA,OAAQ,CAAE,OAAAK,CAAO,CACnB,CAAC,CACH,GAhDE,KAAK,OAAS,CACZ,OAAQR,EAAa,OACrB,UAAW,SACX,QAAS,CACP,MAAOA,EAAa,KACtB,CACF,CACF,CA0CF",
4
+ "sourcesContent": ["import { Extension } from '@magic-sdk/commons';\nimport { CosmosConfig, CosmosPayloadMethod } from './type';\n\nexport class CosmosExtension extends Extension.Internal<'cosmos', any> {\n name = 'cosmos' as const;\n config: any = {};\n\n constructor(public cosmosConfig: CosmosConfig) {\n super();\n\n this.config = {\n rpcUrl: cosmosConfig.rpcUrl,\n chainType: 'COSMOS',\n options: {\n chain: cosmosConfig.chain,\n },\n };\n }\n\n public signAndBroadcast = async (message: any, fee: any) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.SignAndBroadcast,\n params: { message, fee },\n });\n };\n\n public sign = async (message: any, fee: any) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.Sign,\n params: { message, fee },\n });\n };\n\n public signTypedData = (message: string) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.SignTypedData,\n params: { message },\n });\n };\n\n public sendTokens = async (\n recipientAddress: string,\n transferAmount: string | number,\n denom: string,\n memo?: string,\n ) => {\n return this.request({\n id: 42,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.SendTokens,\n params: { recipientAddress, transferAmount, denom, memo },\n });\n };\n\n public changeAddress = async (prefix: string) => {\n return this.request({\n id: 41,\n jsonrpc: '2.0',\n method: CosmosPayloadMethod.ChangeAddress,\n params: { prefix },\n });\n };\n}\n"],
5
+ "mappings": "6MAAA,OAAS,aAAAA,MAAiB,qBAGnB,IAAMC,EAAN,cAA8BC,EAAU,QAAwB,CAIrE,YAAmBC,EAA4B,CAC7C,MAAM,EADW,kBAAAA,EAHnB,UAAO,SACP,YAAc,CAAC,EAcf,KAAO,iBAAmB,CAAOC,EAAcC,IAAaC,EAAA,sBAC1D,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,8BACA,OAAQ,CAAE,QAAAF,EAAS,IAAAC,CAAI,CACzB,CAAC,CACH,GAEA,KAAO,KAAO,CAAOD,EAAcC,IAAaC,EAAA,sBAC9C,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,kBACA,OAAQ,CAAE,QAAAF,EAAS,IAAAC,CAAI,CACzB,CAAC,CACH,GAEA,KAAO,cAAiBD,GACf,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,2BACA,OAAQ,CAAE,QAAAA,CAAQ,CACpB,CAAC,EAGH,KAAO,WAAa,CAClBG,EACAC,EACAC,EACAC,IACGJ,EAAA,sBACH,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,wBACA,OAAQ,CAAE,iBAAAC,EAAkB,eAAAC,EAAgB,MAAAC,EAAO,KAAAC,CAAK,CAC1D,CAAC,CACH,GAEA,KAAO,cAAuBC,GAAmBL,EAAA,sBAC/C,OAAO,KAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,2BACA,OAAQ,CAAE,OAAAK,CAAO,CACnB,CAAC,CACH,GAzDE,KAAK,OAAS,CACZ,OAAQR,EAAa,OACrB,UAAW,SACX,QAAS,CACP,MAAOA,EAAa,KACtB,CACF,CACF,CAmDF",
6
6
  "names": ["Extension", "CosmosExtension", "Extension", "cosmosConfig", "message", "fee", "__async", "recipientAddress", "transferAmount", "denom", "memo", "prefix"]
7
7
  }
package/dist/extension.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var MagicCosmosExtension=(()=>{var y=Object.create;var o=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var C=(s,r)=>()=>(r||s((r={exports:{}}).exports,r),r.exports),T=(s,r)=>{for(var n in r)o(s,n,{get:r[n],enumerable:!0})},m=(s,r,n,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of S(r))!b.call(s,i)&&i!==n&&o(s,i,{get:()=>r[i],enumerable:!(e=A(r,i))||e.enumerable});return s};var j=(s,r,n)=>(n=s!=null?y(x(s)):{},m(r||!s||!s.__esModule?o(n,"default",{value:s,enumerable:!0}):n,s)),k=s=>m(o({},"__esModule",{value:!0}),s);var c=(s,r,n)=>new Promise((e,i)=>{var p=t=>{try{d(n.next(t))}catch(g){i(g)}},l=t=>{try{d(n.throw(t))}catch(g){i(g)}},d=t=>t.done?e(t.value):Promise.resolve(t.value).then(p,l);d((n=n.apply(s,r)).next())});var h=C((U,u)=>{u.exports=Magic});var B={};T(B,{default:()=>q});var f=j(h());var a=class extends f.Extension.Internal{constructor(n){super();this.cosmosConfig=n;this.name="cosmos";this.config={};this.signAndBroadcast=(n,e)=>c(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_signAndBroadcast",params:{message:n,fee:e}})});this.sign=(n,e)=>c(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sign",params:{message:n,fee:e}})});this.sendTokens=(n,e,i,p)=>c(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sendTokens",params:{recipientAddress:n,transferAmount:e,denom:i,memo:p}})});this.changeAddress=n=>c(this,null,function*(){return this.request({id:41,jsonrpc:"2.0",method:"cos_changeAddress",params:{prefix:n}})});this.config={rpcUrl:n.rpcUrl,chainType:"COSMOS",options:{chain:n.chain}}}};var q=a;return k(B);})();
1
+ "use strict";var MagicCosmosExtension=(()=>{var f=Object.create;var c=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var x=(s,r)=>()=>(r||s((r={exports:{}}).exports,r),r.exports),j=(s,r)=>{for(var n in r)c(s,n,{get:r[n],enumerable:!0})},u=(s,r,n,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of l(r))!b.call(s,i)&&i!==n&&c(s,i,{get:()=>r[i],enumerable:!(e=T(r,i))||e.enumerable});return s};var q=(s,r,n)=>(n=s!=null?f(A(s)):{},u(r||!s||!s.__esModule?c(n,"default",{value:s,enumerable:!0}):n,s)),_=s=>u(c({},"__esModule",{value:!0}),s);var a=(s,r,n)=>new Promise((e,i)=>{var p=t=>{try{g(n.next(t))}catch(d){i(d)}},S=t=>{try{g(n.throw(t))}catch(d){i(d)}},g=t=>t.done?e(t.value):Promise.resolve(t.value).then(p,S);g((n=n.apply(s,r)).next())});var h=x((D,m)=>{m.exports=Magic});var B={};j(B,{default:()=>k});var y=q(h());var o=class extends y.Extension.Internal{constructor(n){super();this.cosmosConfig=n;this.name="cosmos";this.config={};this.signAndBroadcast=(n,e)=>a(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_signAndBroadcast",params:{message:n,fee:e}})});this.sign=(n,e)=>a(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sign",params:{message:n,fee:e}})});this.signTypedData=n=>this.request({id:42,jsonrpc:"2.0",method:"cos_signTypedData",params:{message:n}});this.sendTokens=(n,e,i,p)=>a(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sendTokens",params:{recipientAddress:n,transferAmount:e,denom:i,memo:p}})});this.changeAddress=n=>a(this,null,function*(){return this.request({id:41,jsonrpc:"2.0",method:"cos_changeAddress",params:{prefix:n}})});this.config={rpcUrl:n.rpcUrl,chainType:"COSMOS",options:{chain:n.chain}}}};var k=o;return _(B);})();
2
2
  if (MagicCosmosExtension && MagicCosmosExtension.default != null) { MagicCosmosExtension = Object.assign(MagicCosmosExtension.default, MagicCosmosExtension); delete MagicCosmosExtension.default; }
@@ -7,6 +7,12 @@ export declare class CosmosExtension extends Extension.Internal<'cosmos', any> {
7
7
  constructor(cosmosConfig: CosmosConfig);
8
8
  signAndBroadcast: (message: any, fee: any) => Promise<any>;
9
9
  sign: (message: any, fee: any) => Promise<any>;
10
+ signTypedData: (message: string) => import("@magic-sdk/commons").PromiEvent<any, {
11
+ done: (result: any) => void;
12
+ error: (reason: any) => void;
13
+ settled: () => void;
14
+ "closed-by-user": () => void;
15
+ }>;
10
16
  sendTokens: (recipientAddress: string, transferAmount: string | number, denom: string, memo?: string | undefined) => Promise<any>;
11
17
  changeAddress: (prefix: string) => Promise<any>;
12
18
  }
@@ -4,6 +4,7 @@ export interface CosmosConfig {
4
4
  }
5
5
  export declare enum CosmosPayloadMethod {
6
6
  Sign = "cos_sign",
7
+ SignTypedData = "cos_signTypedData",
7
8
  SignAndBroadcast = "cos_signAndBroadcast",
8
9
  SendTokens = "cos_sendTokens",
9
10
  ChangeAddress = "cos_changeAddress"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magic-ext/cosmos",
3
- "version": "23.9.0",
3
+ "version": "23.9.1-canary.045fe98.0",
4
4
  "description": "magic cosmos extension",
5
5
  "author": "Magic <team@magic.link> (https://magic.link/)",
6
6
  "license": "MIT",
@@ -30,5 +30,5 @@
30
30
  "devDependencies": {
31
31
  "@magic-sdk/commons": "^24.9.0"
32
32
  },
33
- "gitHead": "4da0505cb244acc96a2bf1ba597ff65109824689"
33
+ "gitHead": "045fe98f83d41b2f45edbc186d3c85fe689eda5c"
34
34
  }