@magic-ext/cosmos 0.1.0 → 3.0.1

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/CHANGELOG.md CHANGED
@@ -0,0 +1,44 @@
1
+ # v3.0.1 (Tue Jan 25 2022)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Fix CDN build targets [#270](https://github.com/magiclabs/magic-js/pull/270) ([@smithki](https://github.com/smithki))
6
+ - Fix CDN issues related to ESBuild ([@smithki](https://github.com/smithki))
7
+
8
+ #### Authors: 1
9
+
10
+ - Ian K Smith ([@smithki](https://github.com/smithki))
11
+
12
+ ---
13
+
14
+ # v3.0.0 (Tue Jan 25 2022)
15
+
16
+ #### 💥 Breaking Change
17
+
18
+ - Switch from `microbundle` to `esbuild` [#220](https://github.com/magiclabs/magic-js/pull/220) ([@smithki](https://github.com/smithki))
19
+
20
+ #### 🐛 Bug Fix
21
+
22
+ - Merge with master ([@smithki](https://github.com/smithki))
23
+ - Merge branch 'master' into feat/faster-builds ([@smithki](https://github.com/smithki))
24
+ - Modify CDN default exports ([@smithki](https://github.com/smithki))
25
+ - Support newly added Magic JS extensions in ESBuild ([@smithki](https://github.com/smithki))
26
+
27
+ #### Authors: 1
28
+
29
+ - Ian K Smith ([@smithki](https://github.com/smithki))
30
+
31
+ ---
32
+
33
+ # v1.0.0 (Thu Dec 09 2021)
34
+
35
+ #### 💥 Breaking Change
36
+
37
+ - Jerryliu sc 44386 migrate web3 related magic ext repos to magic (PART 1) [#248](https://github.com/magiclabs/magic-js/pull/248) ([@Ethella](https://github.com/Ethella))
38
+
39
+ #### Authors: 1
40
+
41
+ - Jerry Liu ([@Ethella](https://github.com/Ethella))
42
+
43
+ ---
44
+
package/dist/cjs/index.js CHANGED
@@ -1,101 +1,2 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
- return new (P || (P = Promise))(function (resolve, reject) {
18
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
- step((generator = generator.apply(thisArg, _arguments || [])).next());
22
- });
23
- };
24
- var __generator = (this && this.__generator) || function (thisArg, body) {
25
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
26
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
- function verb(n) { return function (v) { return step([n, v]); }; }
28
- function step(op) {
29
- if (f) throw new TypeError("Generator is already executing.");
30
- while (_) try {
31
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
32
- if (y = 0, t) op = [op[0] & 2, t.value];
33
- switch (op[0]) {
34
- case 0: case 1: t = op; break;
35
- case 4: _.label++; return { value: op[1], done: false };
36
- case 5: _.label++; y = op[1]; op = [0]; continue;
37
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
38
- default:
39
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
40
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
41
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
42
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
43
- if (t[2]) _.ops.pop();
44
- _.trys.pop(); continue;
45
- }
46
- op = body.call(thisArg, _);
47
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49
- }
50
- };
51
- Object.defineProperty(exports, "__esModule", { value: true });
52
- exports.CosmosExtension = void 0;
53
- var magic_sdk_1 = require("magic-sdk");
54
- var type_1 = require("./type");
55
- var CosmosExtension = /** @class */ (function (_super) {
56
- __extends(CosmosExtension, _super);
57
- function CosmosExtension(cosmosConfig) {
58
- var _this = _super.call(this) || this;
59
- _this.cosmosConfig = cosmosConfig;
60
- _this.name = 'cosmos';
61
- _this.config = {};
62
- _this.signAndBroadcast = function (message, fee) { return __awaiter(_this, void 0, void 0, function () {
63
- return __generator(this, function (_a) {
64
- return [2 /*return*/, this.request({
65
- id: 42,
66
- jsonrpc: '2.0',
67
- method: type_1.CosmosPayloadMethod.SignAndBroadcast,
68
- params: { message: message, fee: fee },
69
- })];
70
- });
71
- }); };
72
- _this.sign = function (message, fee) { return __awaiter(_this, void 0, void 0, function () {
73
- return __generator(this, function (_a) {
74
- return [2 /*return*/, this.request({
75
- id: 42,
76
- jsonrpc: '2.0',
77
- method: type_1.CosmosPayloadMethod.Sign,
78
- params: { message: message, fee: fee },
79
- })];
80
- });
81
- }); };
82
- _this.sendTokens = function (recipientAddress, transferAmount, denom, memo) { return __awaiter(_this, void 0, void 0, function () {
83
- return __generator(this, function (_a) {
84
- return [2 /*return*/, this.request({
85
- id: 42,
86
- jsonrpc: '2.0',
87
- method: type_1.CosmosPayloadMethod.SendTokens,
88
- params: { recipientAddress: recipientAddress, transferAmount: transferAmount, denom: denom, memo: memo },
89
- })];
90
- });
91
- }); };
92
- _this.config = {
93
- rpcUrl: cosmosConfig.rpcUrl,
94
- chainType: 'COSMOS',
95
- };
96
- return _this;
97
- }
98
- return CosmosExtension;
99
- }(magic_sdk_1.Extension.Internal));
100
- exports.CosmosExtension = CosmosExtension;
101
- //# sourceMappingURL=index.js.map
1
+ var p=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var l=r=>p(r,"__esModule",{value:!0});var h=(r,n)=>{for(var s in n)p(r,s,{get:n[s],enumerable:!0})},b=(r,n,s,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of y(n))!S.call(r,o)&&(s||o!=="default")&&p(r,o,{get:()=>n[o],enumerable:!(e=f(n,o))||e.enumerable});return r};var x=(r=>(n,s)=>r&&r.get(n)||(s=b(l({}),n,1),r&&r.set(n,s),s))(typeof WeakMap!="undefined"?new WeakMap:0);var t=(r,n,s)=>new Promise((e,o)=>{var d=i=>{try{c(s.next(i))}catch(a){o(a)}},u=i=>{try{c(s.throw(i))}catch(a){o(a)}},c=i=>i.done?e(i.value):Promise.resolve(i.value).then(d,u);c((s=s.apply(r,n)).next())});var C={};h(C,{CosmosExtension:()=>m});var g=require("@magic-sdk/commons");var m=class extends g.Extension.Internal{constructor(n){super();this.cosmosConfig=n;this.name="cosmos";this.config={};this.signAndBroadcast=(n,s)=>t(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_signAndBroadcast",params:{message:n,fee:s}})});this.sign=(n,s)=>t(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sign",params:{message:n,fee:s}})});this.sendTokens=(n,s,e,o)=>t(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sendTokens",params:{recipientAddress:n,transferAmount:s,denom:e,memo:o}})});this.config={rpcUrl:n.rpcUrl,chainType:"COSMOS"}}};module.exports=x(C);
2
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources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,EAAE,QAAQ;SACpB,CAAC;;IACJ,CAAC;IAiCH,sBAAC;AAAD,CAAC,AA5CD,CAAqC,qBAAS,CAAC,QAAQ,GA4CtD;AA5CY,0CAAe"}
1
+ {
2
+ "version": 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 };\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"],
5
+ "mappings": "2tBAAA,4CAA0B,8BAGnB,mBAA8B,aAAU,QAAwB,CAIrE,YAAmB,EAA4B,CAC7C,QADiB,oBAHnB,UAAO,SACP,YAAc,GAWP,sBAAmB,CAAO,EAAc,IAAa,wBAC1D,MAAO,MAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,uBACR,OAAQ,CAAE,UAAS,WAIhB,UAAO,CAAO,EAAc,IAAa,wBAC9C,MAAO,MAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,WACR,OAAQ,CAAE,UAAS,WAIhB,gBAAa,CAClB,EACA,EACA,EACA,IACG,wBACH,MAAO,MAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,iBACR,OAAQ,CAAE,mBAAkB,iBAAgB,QAAO,YAlCrD,KAAK,OAAS,CACZ,OAAQ,EAAa,OACrB,UAAW",
6
+ "names": []
7
+ }
package/dist/es/index.js CHANGED
@@ -1,98 +1,2 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- extendStatics(d, b);
10
- function __() { this.constructor = d; }
11
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
- };
13
- })();
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
- var __generator = (this && this.__generator) || function (thisArg, body) {
24
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
26
- function verb(n) { return function (v) { return step([n, v]); }; }
27
- function step(op) {
28
- if (f) throw new TypeError("Generator is already executing.");
29
- while (_) try {
30
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31
- if (y = 0, t) op = [op[0] & 2, t.value];
32
- switch (op[0]) {
33
- case 0: case 1: t = op; break;
34
- case 4: _.label++; return { value: op[1], done: false };
35
- case 5: _.label++; y = op[1]; op = [0]; continue;
36
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
37
- default:
38
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
39
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
40
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
41
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
42
- if (t[2]) _.ops.pop();
43
- _.trys.pop(); continue;
44
- }
45
- op = body.call(thisArg, _);
46
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
47
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48
- }
49
- };
50
- import { Extension } from 'magic-sdk';
51
- import { CosmosPayloadMethod } from './type';
52
- var CosmosExtension = /** @class */ (function (_super) {
53
- __extends(CosmosExtension, _super);
54
- function CosmosExtension(cosmosConfig) {
55
- var _this = _super.call(this) || this;
56
- _this.cosmosConfig = cosmosConfig;
57
- _this.name = 'cosmos';
58
- _this.config = {};
59
- _this.signAndBroadcast = function (message, fee) { return __awaiter(_this, void 0, void 0, function () {
60
- return __generator(this, function (_a) {
61
- return [2 /*return*/, this.request({
62
- id: 42,
63
- jsonrpc: '2.0',
64
- method: CosmosPayloadMethod.SignAndBroadcast,
65
- params: { message: message, fee: fee },
66
- })];
67
- });
68
- }); };
69
- _this.sign = function (message, fee) { return __awaiter(_this, void 0, void 0, function () {
70
- return __generator(this, function (_a) {
71
- return [2 /*return*/, this.request({
72
- id: 42,
73
- jsonrpc: '2.0',
74
- method: CosmosPayloadMethod.Sign,
75
- params: { message: message, fee: fee },
76
- })];
77
- });
78
- }); };
79
- _this.sendTokens = function (recipientAddress, transferAmount, denom, memo) { return __awaiter(_this, void 0, void 0, function () {
80
- return __generator(this, function (_a) {
81
- return [2 /*return*/, this.request({
82
- id: 42,
83
- jsonrpc: '2.0',
84
- method: CosmosPayloadMethod.SendTokens,
85
- params: { recipientAddress: recipientAddress, transferAmount: transferAmount, denom: denom, memo: memo },
86
- })];
87
- });
88
- }); };
89
- _this.config = {
90
- rpcUrl: cosmosConfig.rpcUrl,
91
- chainType: 'COSMOS',
92
- };
93
- return _this;
94
- }
95
- return CosmosExtension;
96
- }(Extension.Internal));
97
- export { CosmosExtension };
98
- //# sourceMappingURL=index.js.map
1
+ var i=(a,s,n)=>new Promise((e,o)=>{var p=r=>{try{t(n.next(r))}catch(c){o(c)}},g=r=>{try{t(n.throw(r))}catch(c){o(c)}},t=r=>r.done?e(r.value):Promise.resolve(r.value).then(p,g);t((n=n.apply(a,s)).next())});import{Extension as m}from"@magic-sdk/commons";var d=class extends m.Internal{constructor(s){super();this.cosmosConfig=s;this.name="cosmos";this.config={};this.signAndBroadcast=(s,n)=>i(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_signAndBroadcast",params:{message:s,fee:n}})});this.sign=(s,n)=>i(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sign",params:{message:s,fee:n}})});this.sendTokens=(s,n,e,o)=>i(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sendTokens",params:{recipientAddress:s,transferAmount:n,denom:e,memo:o}})});this.config={rpcUrl:s.rpcUrl,chainType:"COSMOS"}}};export{d as CosmosExtension};
2
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAgB,mBAAmB,EAAE,MAAM,QAAQ,CAAA;AAE1D;IAAqC,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
+ "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 };\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"],
5
+ "mappings": "6MAAA,+CAGO,mBAA8B,GAAU,QAAwB,CAIrE,YAAmB,EAA4B,CAC7C,QADiB,oBAHnB,UAAO,SACP,YAAc,GAWP,sBAAmB,CAAO,EAAc,IAAa,wBAC1D,MAAO,MAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,uBACR,OAAQ,CAAE,UAAS,WAIhB,UAAO,CAAO,EAAc,IAAa,wBAC9C,MAAO,MAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,WACR,OAAQ,CAAE,UAAS,WAIhB,gBAAa,CAClB,EACA,EACA,EACA,IACG,wBACH,MAAO,MAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,iBACR,OAAQ,CAAE,mBAAkB,iBAAgB,QAAO,YAlCrD,KAAK,OAAS,CACZ,OAAQ,EAAa,OACrB,UAAW",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ var i=(a,s,n)=>new Promise((e,o)=>{var p=r=>{try{t(n.next(r))}catch(c){o(c)}},g=r=>{try{t(n.throw(r))}catch(c){o(c)}},t=r=>r.done?e(r.value):Promise.resolve(r.value).then(p,g);t((n=n.apply(a,s)).next())});import{Extension as m}from"@magic-sdk/commons";var d=class extends m.Internal{constructor(s){super();this.cosmosConfig=s;this.name="cosmos";this.config={};this.signAndBroadcast=(s,n)=>i(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_signAndBroadcast",params:{message:s,fee:n}})});this.sign=(s,n)=>i(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sign",params:{message:s,fee:n}})});this.sendTokens=(s,n,e,o)=>i(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sendTokens",params:{recipientAddress:s,transferAmount:n,denom:e,memo:o}})});this.config={rpcUrl:s.rpcUrl,chainType:"COSMOS"}}};export{d as CosmosExtension};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 };\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"],
5
+ "mappings": "6MAAA,+CAGO,mBAA8B,GAAU,QAAwB,CAIrE,YAAmB,EAA4B,CAC7C,QADiB,oBAHnB,UAAO,SACP,YAAc,GAWP,sBAAmB,CAAO,EAAc,IAAa,wBAC1D,MAAO,MAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,uBACR,OAAQ,CAAE,UAAS,WAIhB,UAAO,CAAO,EAAc,IAAa,wBAC9C,MAAO,MAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,WACR,OAAQ,CAAE,UAAS,WAIhB,gBAAa,CAClB,EACA,EACA,EACA,IACG,wBACH,MAAO,MAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,iBACR,OAAQ,CAAE,mBAAkB,iBAAgB,QAAO,YAlCrD,KAAK,OAAS,CACZ,OAAQ,EAAa,OACrB,UAAW",
6
+ "names": []
7
+ }
package/dist/extension.js CHANGED
@@ -1 +1,2 @@
1
- var MagicCosmosExtension=function(e){var r;return function(e){e.Sign="cos_sign",e.SignAndBroadcast="cos_signAndBroadcast",e.SendTokens="cos_sendTokens"}(r||(r={})),function(e){var n,o;function t(n){var o;return(o=e.call(this)||this).cosmosConfig=n,o.name="cosmos",o.config={},o.signAndBroadcast=function(e,n){try{return Promise.resolve(o.request({id:42,jsonrpc:"2.0",method:r.SignAndBroadcast,params:{message:e,fee:n}}))}catch(e){return Promise.reject(e)}},o.sign=function(e,n){try{return Promise.resolve(o.request({id:42,jsonrpc:"2.0",method:r.Sign,params:{message:e,fee:n}}))}catch(e){return Promise.reject(e)}},o.sendTokens=function(e,n,t,s){try{return Promise.resolve(o.request({id:42,jsonrpc:"2.0",method:r.SendTokens,params:{recipientAddress:e,transferAmount:n,denom:t,memo:s}}))}catch(e){return Promise.reject(e)}},o.config={rpcUrl:n.rpcUrl,chainType:"COSMOS"},o}return o=e,(n=t).prototype=Object.create(o.prototype),n.prototype.constructor=n,n.__proto__=o,t}(e.Extension.Internal)}(Magic);
1
+ var MagicCosmosExtension=(()=>{var S=Object.create;var e=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty;var m=s=>e(s,"__esModule",{value:!0});var k=(s,n)=>()=>(n||s((n={exports:{}}).exports,n),n.exports),A=(s,n)=>{for(var r in n)e(s,r,{get:n[r],enumerable:!0})},d=(s,n,r,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of C(n))!T.call(s,o)&&(r||o!=="default")&&e(s,o,{get:()=>n[o],enumerable:!(t=h(n,o))||t.enumerable});return s},B=(s,n)=>d(m(e(s!=null?S(b(s)):{},"default",!n&&s&&s.__esModule?{get:()=>s.default,enumerable:!0}:{value:s,enumerable:!0})),s),j=(s=>(n,r)=>s&&s.get(n)||(r=d(m({}),n,1),s&&s.set(n,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var c=(s,n,r)=>new Promise((t,o)=>{var x=i=>{try{a(r.next(i))}catch(p){o(p)}},y=i=>{try{a(r.throw(i))}catch(p){o(p)}},a=i=>i.done?t(i.value):Promise.resolve(i.value).then(x,y);a((r=r.apply(s,n)).next())});var f=k((E,u)=>{u.exports=Magic});var U={};A(U,{default:()=>q});var l=B(f());var g=class extends l.Extension.Internal{constructor(n){super();this.cosmosConfig=n;this.name="cosmos";this.config={};this.signAndBroadcast=(n,r)=>c(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_signAndBroadcast",params:{message:n,fee:r}})});this.sign=(n,r)=>c(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sign",params:{message:n,fee:r}})});this.sendTokens=(n,r,t,o)=>c(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sendTokens",params:{recipientAddress:n,transferAmount:r,denom:t,memo:o}})});this.config={rpcUrl:n.rpcUrl,chainType:"COSMOS"}}};var q=g;return j(U);})();
2
+ if (MagicCosmosExtension && MagicCosmosExtension.default != null) { MagicCosmosExtension = Object.assign(MagicCosmosExtension.default, MagicCosmosExtension); delete MagicCosmosExtension.default; }
@@ -0,0 +1,2 @@
1
+ var p=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var l=r=>p(r,"__esModule",{value:!0});var h=(r,n)=>{for(var s in n)p(r,s,{get:n[s],enumerable:!0})},b=(r,n,s,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of y(n))!S.call(r,o)&&(s||o!=="default")&&p(r,o,{get:()=>n[o],enumerable:!(e=f(n,o))||e.enumerable});return r};var x=(r=>(n,s)=>r&&r.get(n)||(s=b(l({}),n,1),r&&r.set(n,s),s))(typeof WeakMap!="undefined"?new WeakMap:0);var t=(r,n,s)=>new Promise((e,o)=>{var d=i=>{try{c(s.next(i))}catch(a){o(a)}},u=i=>{try{c(s.throw(i))}catch(a){o(a)}},c=i=>i.done?e(i.value):Promise.resolve(i.value).then(d,u);c((s=s.apply(r,n)).next())});var C={};h(C,{CosmosExtension:()=>m});var g=require("@magic-sdk/commons");var m=class extends g.Extension.Internal{constructor(n){super();this.cosmosConfig=n;this.name="cosmos";this.config={};this.signAndBroadcast=(n,s)=>t(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_signAndBroadcast",params:{message:n,fee:s}})});this.sign=(n,s)=>t(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sign",params:{message:n,fee:s}})});this.sendTokens=(n,s,e,o)=>t(this,null,function*(){return this.request({id:42,jsonrpc:"2.0",method:"cos_sendTokens",params:{recipientAddress:n,transferAmount:s,denom:e,memo:o}})});this.config={rpcUrl:n.rpcUrl,chainType:"COSMOS"}}};module.exports=x(C);
2
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 };\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"],
5
+ "mappings": "2tBAAA,4CAA0B,8BAGnB,mBAA8B,aAAU,QAAwB,CAIrE,YAAmB,EAA4B,CAC7C,QADiB,oBAHnB,UAAO,SACP,YAAc,GAWP,sBAAmB,CAAO,EAAc,IAAa,wBAC1D,MAAO,MAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,uBACR,OAAQ,CAAE,UAAS,WAIhB,UAAO,CAAO,EAAc,IAAa,wBAC9C,MAAO,MAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,WACR,OAAQ,CAAE,UAAS,WAIhB,gBAAa,CAClB,EACA,EACA,EACA,IACG,wBACH,MAAO,MAAK,QAAQ,CAClB,GAAI,GACJ,QAAS,MACT,OAAQ,iBACR,OAAQ,CAAE,mBAAkB,iBAAgB,QAAO,YAlCrD,KAAK,OAAS,CACZ,OAAQ,EAAa,OACrB,UAAW",
6
+ "names": []
7
+ }
@@ -1,2 +1,2 @@
1
1
  import { CosmosExtension } from './index';
2
- export { CosmosExtension as default };
2
+ export default CosmosExtension;
@@ -1,4 +1,4 @@
1
- import { Extension } from 'magic-sdk';
1
+ import { Extension } from '@magic-sdk/commons';
2
2
  import { CosmosConfig } from './type';
3
3
  export declare class CosmosExtension extends Extension.Internal<'cosmos', any> {
4
4
  cosmosConfig: CosmosConfig;
@@ -0,0 +1 @@
1
+ export * from './index';
File without changes
package/package.json CHANGED
@@ -1,50 +1,34 @@
1
1
  {
2
2
  "name": "@magic-ext/cosmos",
3
- "version": "0.1.0",
3
+ "version": "3.0.1",
4
4
  "description": "magic cosmos extension",
5
- "author": "Magic <hello@magic.link> (https://magic.link/)",
5
+ "author": "Magic <team@magic.link> (https://magic.link/)",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/fortmatic/magic-sdk-extensions"
9
+ "url": "https://github.com/magiclabs/magic-js"
10
10
  },
11
11
  "files": [
12
- "dist/**/*.js",
13
- "dist/**/*.js.map",
14
- "dist/**/*.d.ts"
12
+ "dist"
15
13
  ],
16
- "umdGlobal": "MagicCosmosExtension",
17
- "main": "dist/cjs/index.js",
18
- "umd:main": "dist/extension.js",
19
- "module": "dist/es/index.js",
20
- "types": "dist/cjs/index.d.ts",
21
- "devDependencies": {
22
- "magic-sdk": "^2.6.0"
23
- },
24
- "ava": {
25
- "require": [
26
- "ts-node/register",
27
- "./test/setup.ts"
28
- ],
29
- "files": [
30
- "test/**/*.spec.ts"
31
- ],
32
- "extensions": [
33
- "ts"
34
- ],
35
- "verbose": true
14
+ "target": "neutral",
15
+ "cdnGlobalName": "MagicCosmosExtension",
16
+ "main": "./dist/cjs/index.js",
17
+ "module": "./dist/es/index.js",
18
+ "types": "./dist/types/index.d.ts",
19
+ "jsdelivr": "./dist/extension.js",
20
+ "react-native": "./dist/react-native/index.native.js",
21
+ "exports": {
22
+ "import": "./dist/es/index.mjs",
23
+ "require": "./dist/cjs/index.js"
36
24
  },
37
- "nyc": {
38
- "extends": "@istanbuljs/nyc-config-typescript",
39
- "all": false,
40
- "check-coverage": true,
41
- "per-file": true,
42
- "lines": 99,
43
- "statements": 99,
44
- "functions": 99,
45
- "branches": 99,
46
- "reporter": [
47
- "lcov"
25
+ "externals": {
26
+ "include": [
27
+ "@magic-sdk/commons"
48
28
  ]
49
- }
29
+ },
30
+ "devDependencies": {
31
+ "@magic-sdk/commons": "^4.0.0"
32
+ },
33
+ "gitHead": "d438b0b289fd4dd06a19bbb0f9f8d27bb067cea0"
50
34
  }
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = void 0;
4
- var index_1 = require("./index");
5
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return index_1.CosmosExtension; } });
6
- //# sourceMappingURL=index.cdn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cdn.js","sourceRoot":"","sources":["../../src/index.cdn.ts"],"names":[],"mappings":";;;AAAA,iCAA0C;AAEd,wFAFnB,uBAAe,OAEW"}
@@ -1,11 +0,0 @@
1
- import { Extension } from 'magic-sdk';
2
- import { CosmosConfig } from './type';
3
- export declare class CosmosExtension extends Extension.Internal<'cosmos', any> {
4
- cosmosConfig: CosmosConfig;
5
- name: "cosmos";
6
- config: any;
7
- constructor(cosmosConfig: CosmosConfig);
8
- signAndBroadcast: (message: any, fee: any) => Promise<any>;
9
- sign: (message: any, fee: any) => Promise<any>;
10
- sendTokens: (recipientAddress: string, transferAmount: string | number, denom: string, memo?: string | undefined) => Promise<any>;
11
- }
package/dist/cjs/type.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CosmosPayloadMethod = void 0;
4
- var CosmosPayloadMethod;
5
- (function (CosmosPayloadMethod) {
6
- CosmosPayloadMethod["Sign"] = "cos_sign";
7
- CosmosPayloadMethod["SignAndBroadcast"] = "cos_signAndBroadcast";
8
- CosmosPayloadMethod["SendTokens"] = "cos_sendTokens";
9
- })(CosmosPayloadMethod = exports.CosmosPayloadMethod || (exports.CosmosPayloadMethod = {}));
10
- //# sourceMappingURL=type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/type.ts"],"names":[],"mappings":";;;AAIA,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC3B,wCAAiB,CAAA;IACjB,gEAAyC,CAAA;IACzC,oDAA6B,CAAA;AACjC,CAAC,EAJW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAI9B"}
@@ -1,2 +0,0 @@
1
- import { CosmosExtension } from './index';
2
- export { CosmosExtension as default };
@@ -1,3 +0,0 @@
1
- import { CosmosExtension } from './index';
2
- export { CosmosExtension as default };
3
- //# sourceMappingURL=index.cdn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cdn.js","sourceRoot":"","sources":["../../src/index.cdn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,CAAC"}
package/dist/es/type.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export interface CosmosConfig {
2
- rpcUrl: string;
3
- }
4
- export declare enum CosmosPayloadMethod {
5
- Sign = "cos_sign",
6
- SignAndBroadcast = "cos_signAndBroadcast",
7
- SendTokens = "cos_sendTokens"
8
- }
package/dist/es/type.js DELETED
@@ -1,7 +0,0 @@
1
- export var CosmosPayloadMethod;
2
- (function (CosmosPayloadMethod) {
3
- CosmosPayloadMethod["Sign"] = "cos_sign";
4
- CosmosPayloadMethod["SignAndBroadcast"] = "cos_signAndBroadcast";
5
- CosmosPayloadMethod["SendTokens"] = "cos_sendTokens";
6
- })(CosmosPayloadMethod || (CosmosPayloadMethod = {}));
7
- //# sourceMappingURL=type.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/type.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC3B,wCAAiB,CAAA;IACjB,gEAAyC,CAAA;IACzC,oDAA6B,CAAA;AACjC,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB,QAI9B"}