@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 +44 -0
- package/dist/cjs/index.js +2 -101
- package/dist/cjs/index.js.map +7 -1
- package/dist/es/index.js +2 -98
- package/dist/es/index.js.map +7 -1
- package/dist/es/index.mjs +2 -0
- package/dist/es/index.mjs.map +7 -0
- package/dist/extension.js +2 -1
- package/dist/react-native/index.native.js +2 -0
- package/dist/react-native/index.native.js.map +7 -0
- package/dist/{cjs → types}/index.cdn.d.ts +1 -1
- package/dist/{es → types}/index.d.ts +1 -1
- package/dist/types/index.native.d.ts +1 -0
- package/dist/{cjs → types}/type.d.ts +0 -0
- package/package.json +22 -38
- package/dist/cjs/index.cdn.js +0 -6
- package/dist/cjs/index.cdn.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -11
- package/dist/cjs/type.js +0 -10
- package/dist/cjs/type.js.map +0 -1
- package/dist/es/index.cdn.d.ts +0 -2
- package/dist/es/index.cdn.js +0 -3
- package/dist/es/index.cdn.js.map +0 -1
- package/dist/es/type.d.ts +0 -8
- package/dist/es/type.js +0 -7
- package/dist/es/type.js.map +0 -1
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
|
-
"
|
|
2
|
-
|
|
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
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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
|
|
2
|
-
|
|
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
|
package/dist/es/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
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
|
+
}
|
|
@@ -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=
|
|
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
|
|
2
|
+
export default CosmosExtension;
|
|
@@ -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
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "magic cosmos extension",
|
|
5
|
-
"author": "Magic <
|
|
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/
|
|
9
|
+
"url": "https://github.com/magiclabs/magic-js"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
|
-
"dist
|
|
13
|
-
"dist/**/*.js.map",
|
|
14
|
-
"dist/**/*.d.ts"
|
|
12
|
+
"dist"
|
|
15
13
|
],
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"module": "dist/es/index.js",
|
|
20
|
-
"types": "dist/
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
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
|
}
|
package/dist/cjs/index.cdn.js
DELETED
|
@@ -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"}
|
package/dist/cjs/index.d.ts
DELETED
|
@@ -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
|
package/dist/cjs/type.js.map
DELETED
|
@@ -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"}
|
package/dist/es/index.cdn.d.ts
DELETED
package/dist/es/index.cdn.js
DELETED
package/dist/es/index.cdn.js.map
DELETED
|
@@ -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
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
|
package/dist/es/type.js.map
DELETED
|
@@ -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"}
|