@magic-ext/bitcoin 0.1.1 → 2.0.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/CHANGELOG.md +12 -0
- package/dist/cjs/index.js +2 -78
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +2 -75
- package/dist/es/index.js.map +1 -1
- package/dist/extension.js +1 -1
- package/dist/modern/index.mjs +2 -0
- package/dist/modern/index.mjs.map +1 -0
- package/dist/react-native/index.native.js +2 -0
- package/dist/react-native/index.native.js.map +1 -0
- package/dist/{cjs → types}/index.cdn.d.ts +2 -2
- package/dist/{es → types}/index.d.ts +9 -9
- package/dist/{cjs → types}/types.d.ts +7 -6
- package/package.json +22 -39
- package/dist/cjs/index.cdn.js +0 -6
- package/dist/cjs/index.cdn.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -9
- package/dist/cjs/types.js +0 -8
- package/dist/cjs/types.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/types.d.ts +0 -6
- package/dist/es/types.js +0 -5
- package/dist/es/types.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# v1.0.0 (Wed Oct 27 2021)
|
|
2
|
+
|
|
3
|
+
#### 💥 Breaking Change
|
|
4
|
+
|
|
5
|
+
- add bitcoin extension for web and react native [#233](https://github.com/magiclabs/magic-js/pull/233) ([@hcote](https://github.com/hcote))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- Hunter Cote ([@hcote](https://github.com/hcote))
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,78 +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.BitcoinExtension = void 0;
|
|
53
|
-
var magic_sdk_1 = require("magic-sdk");
|
|
54
|
-
var types_1 = require("./types");
|
|
55
|
-
var BitcoinExtension = /** @class */ (function (_super) {
|
|
56
|
-
__extends(BitcoinExtension, _super);
|
|
57
|
-
function BitcoinExtension(bitcoinConfig) {
|
|
58
|
-
var _this = _super.call(this) || this;
|
|
59
|
-
_this.bitcoinConfig = bitcoinConfig;
|
|
60
|
-
_this.name = 'bitcoin';
|
|
61
|
-
_this.config = {};
|
|
62
|
-
_this.config = {
|
|
63
|
-
rpcUrl: bitcoinConfig.rpcUrl,
|
|
64
|
-
chainType: 'BITCOIN',
|
|
65
|
-
};
|
|
66
|
-
return _this;
|
|
67
|
-
}
|
|
68
|
-
BitcoinExtension.prototype.signTransaction = function (txn) {
|
|
69
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
-
return __generator(this, function (_a) {
|
|
71
|
-
return [2 /*return*/, this.request(this.utils.createJsonRpcRequestPayload(types_1.BitcoinPayloadMethod.BitcoinSignTransaction, [txn]))];
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
return BitcoinExtension;
|
|
76
|
-
}(magic_sdk_1.Extension.Internal));
|
|
77
|
-
exports.BitcoinExtension = BitcoinExtension;
|
|
78
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
var t,n=require("@magic-sdk/commons");function o(t,n){return(o=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}!function(t){t.BitcoinSignTransaction="btc_signTransaction"}(t||(t={})),exports.BitcoinExtension=function(n){var r,i;function e(t){var o;return(o=n.call(this)||this).bitcoinConfig=void 0,o.name="bitcoin",o.config={},o.bitcoinConfig=t,o.config={rpcUrl:t.rpcUrl,chainType:"BITCOIN",options:{network:t.network}},o}return i=n,(r=e).prototype=Object.create(i.prototype),r.prototype.constructor=r,o(r,i),e.prototype.signTransaction=function(n,o){try{return Promise.resolve(this.request(this.utils.createJsonRpcRequestPayload(t.BitcoinSignTransaction,[n,o])))}catch(t){return Promise.reject(t)}},e}(n.Extension.Internal);
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/types.ts","../../src/index.ts"],"sourcesContent":["export interface BitcoinConfig {\n rpcUrl: string;\n network: string;\n}\n\nexport enum BitcoinPayloadMethod {\n BitcoinSignTransaction = 'btc_signTransaction',\n}\n","import { Extension } from '@magic-sdk/commons';\nimport { BitcoinConfig, BitcoinPayloadMethod } from './types';\n\nexport class BitcoinExtension extends Extension.Internal<'bitcoin', any> {\n name = 'bitcoin' as const;\n config: any = {};\n\n constructor(public bitcoinConfig: BitcoinConfig) {\n super();\n\n this.config = {\n rpcUrl: bitcoinConfig.rpcUrl,\n chainType: 'BITCOIN',\n options: {\n network: bitcoinConfig.network,\n },\n };\n }\n\n public async signTransaction(txn: string, inputIndex: number) {\n return this.request(\n this.utils.createJsonRpcRequestPayload(BitcoinPayloadMethod.BitcoinSignTransaction, [txn, inputIndex]),\n );\n }\n}\n"],"names":["BitcoinPayloadMethod","bitcoinConfig","_this","name","config","rpcUrl","chainType","options","network","signTransaction","txn","inputIndex","this","request","utils","createJsonRpcRequestPayload","BitcoinSignTransaction","Extension","Internal"],"mappings":"IAKYA,+HAAZ,SAAYA,GACVA,+CADF,CAAYA,IAAAA,oDCEV,WAAmBC,gBACjBC,sBADiBD,uBAHnBE,KAAO,YACPC,OAAc,GAEKF,gBAAAD,EAGjBC,EAAKE,OAAS,CACZC,OAAQJ,EAAcI,OACtBC,UAAW,UACXC,QAAS,CACPC,QAASP,EAAcO,+GAKhBC,yBAAgBC,EAAaC,OACxC,uBAAOC,KAAKC,QAALD,KACAE,MAAMC,4BAA4Bf,EAAqBgB,uBAAwB,CAACN,EAAKC,MAlBhG,uCAAsCM,YAAUC"}
|
package/dist/es/index.js
CHANGED
|
@@ -1,75 +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 { BitcoinPayloadMethod } from './types';
|
|
52
|
-
var BitcoinExtension = /** @class */ (function (_super) {
|
|
53
|
-
__extends(BitcoinExtension, _super);
|
|
54
|
-
function BitcoinExtension(bitcoinConfig) {
|
|
55
|
-
var _this = _super.call(this) || this;
|
|
56
|
-
_this.bitcoinConfig = bitcoinConfig;
|
|
57
|
-
_this.name = 'bitcoin';
|
|
58
|
-
_this.config = {};
|
|
59
|
-
_this.config = {
|
|
60
|
-
rpcUrl: bitcoinConfig.rpcUrl,
|
|
61
|
-
chainType: 'BITCOIN',
|
|
62
|
-
};
|
|
63
|
-
return _this;
|
|
64
|
-
}
|
|
65
|
-
BitcoinExtension.prototype.signTransaction = function (txn) {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
-
return __generator(this, function (_a) {
|
|
68
|
-
return [2 /*return*/, this.request(this.utils.createJsonRpcRequestPayload(BitcoinPayloadMethod.BitcoinSignTransaction, [txn]))];
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
return BitcoinExtension;
|
|
73
|
-
}(Extension.Internal));
|
|
74
|
-
export { BitcoinExtension };
|
|
75
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import{Extension as t}from"@magic-sdk/commons";function n(t,o){return(n=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,o)}var o;!function(t){t.BitcoinSignTransaction="btc_signTransaction"}(o||(o={}));var r=function(t){var r,i;function c(n){var o;return(o=t.call(this)||this).bitcoinConfig=void 0,o.name="bitcoin",o.config={},o.bitcoinConfig=n,o.config={rpcUrl:n.rpcUrl,chainType:"BITCOIN",options:{network:n.network}},o}return i=t,(r=c).prototype=Object.create(i.prototype),r.prototype.constructor=r,n(r,i),c.prototype.signTransaction=function(t,n){try{return Promise.resolve(this.request(this.utils.createJsonRpcRequestPayload(o.BitcoinSignTransaction,[t,n])))}catch(t){return Promise.reject(t)}},c}(t.Internal);export{r as BitcoinExtension};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/dist/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/types.ts","../../src/index.ts"],"sourcesContent":["export interface BitcoinConfig {\n rpcUrl: string;\n network: string;\n}\n\nexport enum BitcoinPayloadMethod {\n BitcoinSignTransaction = 'btc_signTransaction',\n}\n","import { Extension } from '@magic-sdk/commons';\nimport { BitcoinConfig, BitcoinPayloadMethod } from './types';\n\nexport class BitcoinExtension extends Extension.Internal<'bitcoin', any> {\n name = 'bitcoin' as const;\n config: any = {};\n\n constructor(public bitcoinConfig: BitcoinConfig) {\n super();\n\n this.config = {\n rpcUrl: bitcoinConfig.rpcUrl,\n chainType: 'BITCOIN',\n options: {\n network: bitcoinConfig.network,\n },\n };\n }\n\n public async signTransaction(txn: string, inputIndex: number) {\n return this.request(\n this.utils.createJsonRpcRequestPayload(BitcoinPayloadMethod.BitcoinSignTransaction, [txn, inputIndex]),\n );\n }\n}\n"],"names":["BitcoinPayloadMethod","BitcoinExtension","bitcoinConfig","_this","name","config","rpcUrl","chainType","options","network","signTransaction","txn","inputIndex","this","request","utils","createJsonRpcRequestPayload","BitcoinSignTransaction","Extension","Internal"],"mappings":"+IAKYA,GAAZ,SAAYA,GACVA,+CADF,CAAYA,IAAAA,OCFCC,IAAAA,sBAIX,WAAmBC,gBACjBC,sBADiBD,uBAHnBE,KAAO,YACPC,OAAc,GAEKF,gBAAAD,EAGjBC,EAAKE,OAAS,CACZC,OAAQJ,EAAcI,OACtBC,UAAW,UACXC,QAAS,CACPC,QAASP,EAAcO,+GAKhBC,yBAAgBC,EAAaC,OACxC,uBAAOC,KAAKC,QAALD,KACAE,MAAMC,4BAA4BhB,EAAqBiB,uBAAwB,CAACN,EAAKC,MAlBhG,uCAAsCM,EAAUC"}
|
package/dist/extension.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var MagicBitcoinExtension=function(t){var
|
|
1
|
+
var MagicBitcoinExtension=function(t){function n(t,o){return(n=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,o)}var o;return function(t){t.BitcoinSignTransaction="btc_signTransaction"}(o||(o={})),function(t){var i,r;function c(n){var o;return(o=t.call(this)||this).bitcoinConfig=void 0,o.name="bitcoin",o.config={},o.bitcoinConfig=n,o.config={rpcUrl:n.rpcUrl,chainType:"BITCOIN",options:{network:n.network}},o}return r=t,(i=c).prototype=Object.create(r.prototype),i.prototype.constructor=i,n(i,r),c.prototype.signTransaction=function(t,n){try{return Promise.resolve(this.request(this.utils.createJsonRpcRequestPayload(o.BitcoinSignTransaction,[t,n])))}catch(t){return Promise.reject(t)}},c}(t.Extension.Internal)}(Magic);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Extension as i}from"@magic-sdk/commons";var n;!function(i){i.BitcoinSignTransaction="btc_signTransaction"}(n||(n={}));class t extends i.Internal{constructor(i){super(),this.bitcoinConfig=void 0,this.name="bitcoin",this.config={},this.bitcoinConfig=i,this.config={rpcUrl:i.rpcUrl,chainType:"BITCOIN",options:{network:i.network}}}async signTransaction(i,t){return this.request(this.utils.createJsonRpcRequestPayload(n.BitcoinSignTransaction,[i,t]))}}export{t as BitcoinExtension};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../src/types.ts","../../src/index.ts"],"sourcesContent":["export interface BitcoinConfig {\n rpcUrl: string;\n network: string;\n}\n\nexport enum BitcoinPayloadMethod {\n BitcoinSignTransaction = 'btc_signTransaction',\n}\n","import { Extension } from '@magic-sdk/commons';\nimport { BitcoinConfig, BitcoinPayloadMethod } from './types';\n\nexport class BitcoinExtension extends Extension.Internal<'bitcoin', any> {\n name = 'bitcoin' as const;\n config: any = {};\n\n constructor(public bitcoinConfig: BitcoinConfig) {\n super();\n\n this.config = {\n rpcUrl: bitcoinConfig.rpcUrl,\n chainType: 'BITCOIN',\n options: {\n network: bitcoinConfig.network,\n },\n };\n }\n\n public async signTransaction(txn: string, inputIndex: number) {\n return this.request(\n this.utils.createJsonRpcRequestPayload(BitcoinPayloadMethod.BitcoinSignTransaction, [txn, inputIndex]),\n );\n }\n}\n"],"names":["BitcoinPayloadMethod","BitcoinExtension","Extension","Internal","constructor","bitcoinConfig","super","name","config","this","rpcUrl","chainType","options","network","signTransaction","txn","inputIndex","request","utils","createJsonRpcRequestPayload","BitcoinSignTransaction"],"mappings":"mDAKYA,GAAZ,SAAYA,GACVA,+CADF,CAAYA,IAAAA,aCFCC,UAAyBC,EAAUC,SAI9CC,YAAmBC,GACjBC,aADiBD,0BAHnBE,KAAO,eACPC,OAAc,GAEKC,mBAAAJ,EAGjBI,KAAKD,OAAS,CACZE,OAAQL,EAAcK,OACtBC,UAAW,UACXC,QAAS,CACPC,QAASR,EAAcQ,UAKDC,sBAACC,EAAaC,GACxC,YAAYC,QACVR,KAAKS,MAAMC,4BAA4BnB,EAAqBoB,uBAAwB,CAACL,EAAKC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var t,n=require("@magic-sdk/commons");function o(t,n){return(o=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}!function(t){t.BitcoinSignTransaction="btc_signTransaction"}(t||(t={})),exports.BitcoinExtension=function(n){var r,i;function e(t){var o;return(o=n.call(this)||this).bitcoinConfig=void 0,o.name="bitcoin",o.config={},o.bitcoinConfig=t,o.config={rpcUrl:t.rpcUrl,chainType:"BITCOIN",options:{network:t.network}},o}return i=n,(r=e).prototype=Object.create(i.prototype),r.prototype.constructor=r,o(r,i),e.prototype.signTransaction=function(n,o){try{return Promise.resolve(this.request(this.utils.createJsonRpcRequestPayload(t.BitcoinSignTransaction,[n,o])))}catch(t){return Promise.reject(t)}},e}(n.Extension.Internal);
|
|
2
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.js","sources":["../../src/types.ts","../../src/index.ts"],"sourcesContent":["export interface BitcoinConfig {\n rpcUrl: string;\n network: string;\n}\n\nexport enum BitcoinPayloadMethod {\n BitcoinSignTransaction = 'btc_signTransaction',\n}\n","import { Extension } from '@magic-sdk/commons';\nimport { BitcoinConfig, BitcoinPayloadMethod } from './types';\n\nexport class BitcoinExtension extends Extension.Internal<'bitcoin', any> {\n name = 'bitcoin' as const;\n config: any = {};\n\n constructor(public bitcoinConfig: BitcoinConfig) {\n super();\n\n this.config = {\n rpcUrl: bitcoinConfig.rpcUrl,\n chainType: 'BITCOIN',\n options: {\n network: bitcoinConfig.network,\n },\n };\n }\n\n public async signTransaction(txn: string, inputIndex: number) {\n return this.request(\n this.utils.createJsonRpcRequestPayload(BitcoinPayloadMethod.BitcoinSignTransaction, [txn, inputIndex]),\n );\n }\n}\n"],"names":["BitcoinPayloadMethod","bitcoinConfig","_this","name","config","rpcUrl","chainType","options","network","signTransaction","txn","inputIndex","this","request","utils","createJsonRpcRequestPayload","BitcoinSignTransaction","Extension","Internal"],"mappings":"IAKYA,+HAAZ,SAAYA,GACVA,+CADF,CAAYA,IAAAA,oDCEV,WAAmBC,gBACjBC,sBADiBD,uBAHnBE,KAAO,YACPC,OAAc,GAEKF,gBAAAD,EAGjBC,EAAKE,OAAS,CACZC,OAAQJ,EAAcI,OACtBC,UAAW,UACXC,QAAS,CACPC,QAASP,EAAcO,+GAKhBC,yBAAgBC,EAAaC,OACxC,uBAAOC,KAAKC,QAALD,KACAE,MAAMC,4BAA4Bf,EAAqBgB,uBAAwB,CAACN,EAAKC,MAlBhG,uCAAsCM,YAAUC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BitcoinExtension } from './index';
|
|
2
|
-
export { BitcoinExtension as default };
|
|
1
|
+
import { BitcoinExtension } from './index';
|
|
2
|
+
export { BitcoinExtension as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Extension } from 'magic-sdk';
|
|
2
|
-
import { BitcoinConfig } from './types';
|
|
3
|
-
export declare class BitcoinExtension extends Extension.Internal<'bitcoin', any> {
|
|
4
|
-
bitcoinConfig: BitcoinConfig;
|
|
5
|
-
name: "bitcoin";
|
|
6
|
-
config: any;
|
|
7
|
-
constructor(bitcoinConfig: BitcoinConfig);
|
|
8
|
-
signTransaction(txn:
|
|
9
|
-
}
|
|
1
|
+
import { Extension } from '@magic-sdk/commons';
|
|
2
|
+
import { BitcoinConfig } from './types';
|
|
3
|
+
export declare class BitcoinExtension extends Extension.Internal<'bitcoin', any> {
|
|
4
|
+
bitcoinConfig: BitcoinConfig;
|
|
5
|
+
name: "bitcoin";
|
|
6
|
+
config: any;
|
|
7
|
+
constructor(bitcoinConfig: BitcoinConfig);
|
|
8
|
+
signTransaction(txn: string, inputIndex: number): Promise<any>;
|
|
9
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export interface BitcoinConfig {
|
|
2
|
-
rpcUrl: string;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export interface BitcoinConfig {
|
|
2
|
+
rpcUrl: string;
|
|
3
|
+
network: string;
|
|
4
|
+
}
|
|
5
|
+
export declare enum BitcoinPayloadMethod {
|
|
6
|
+
BitcoinSignTransaction = "btc_signTransaction"
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,51 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magic-ext/bitcoin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "magic bitcoin 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
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"require": [
|
|
27
|
-
"ts-node/register",
|
|
28
|
-
"./test/setup.ts"
|
|
29
|
-
],
|
|
30
|
-
"files": [
|
|
31
|
-
"test/**/*.spec.ts"
|
|
32
|
-
],
|
|
33
|
-
"extensions": [
|
|
34
|
-
"ts"
|
|
35
|
-
],
|
|
36
|
-
"verbose": true
|
|
14
|
+
"target": "web",
|
|
15
|
+
"cdnGlobalName": "MagicBitcoinExtension",
|
|
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/modern/index.mjs",
|
|
23
|
+
"require": "./dist/cjs/index.js"
|
|
37
24
|
},
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
"check-coverage": true,
|
|
42
|
-
"per-file": true,
|
|
43
|
-
"lines": 99,
|
|
44
|
-
"statements": 99,
|
|
45
|
-
"functions": 99,
|
|
46
|
-
"branches": 99,
|
|
47
|
-
"reporter": [
|
|
48
|
-
"lcov"
|
|
25
|
+
"externals": {
|
|
26
|
+
"include": [
|
|
27
|
+
"@magic-sdk/commons"
|
|
49
28
|
]
|
|
50
|
-
}
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@magic-sdk/commons": "^3.0.0"
|
|
32
|
+
},
|
|
33
|
+
"gitHead": "a85f41892cbd7985ee1743764f7f905b89004eaa"
|
|
51
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.BitcoinExtension; } });
|
|
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,iCAA2C;AAEd,wFAFpB,wBAAgB,OAEW"}
|
package/dist/cjs/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Extension } from 'magic-sdk';
|
|
2
|
-
import { BitcoinConfig } from './types';
|
|
3
|
-
export declare class BitcoinExtension extends Extension.Internal<'bitcoin', any> {
|
|
4
|
-
bitcoinConfig: BitcoinConfig;
|
|
5
|
-
name: "bitcoin";
|
|
6
|
-
config: any;
|
|
7
|
-
constructor(bitcoinConfig: BitcoinConfig);
|
|
8
|
-
signTransaction(txn: any): Promise<any>;
|
|
9
|
-
}
|
package/dist/cjs/types.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BitcoinPayloadMethod = void 0;
|
|
4
|
-
var BitcoinPayloadMethod;
|
|
5
|
-
(function (BitcoinPayloadMethod) {
|
|
6
|
-
BitcoinPayloadMethod["BitcoinSignTransaction"] = "btc_signTransaction";
|
|
7
|
-
})(BitcoinPayloadMethod = exports.BitcoinPayloadMethod || (exports.BitcoinPayloadMethod = {}));
|
|
8
|
-
//# sourceMappingURL=types.js.map
|
package/dist/cjs/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAIA,IAAY,oBAEX;AAFD,WAAY,oBAAoB;IAC5B,sEAA8C,CAAA;AAClD,CAAC,EAFW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAE/B"}
|
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,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,gBAAgB,IAAI,OAAO,EAAE,CAAC"}
|
package/dist/es/types.d.ts
DELETED
package/dist/es/types.js
DELETED
package/dist/es/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,oBAEX;AAFD,WAAY,oBAAoB;IAC5B,sEAA8C,CAAA;AAClD,CAAC,EAFW,oBAAoB,KAApB,oBAAoB,QAE/B"}
|