@magic-ext/bitcoin 0.1.2 → 3.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 CHANGED
@@ -0,0 +1,31 @@
1
+ # v3.0.0 (Tue Jan 25 2022)
2
+
3
+ #### 💥 Breaking Change
4
+
5
+ - Switch from `microbundle` to `esbuild` [#220](https://github.com/magiclabs/magic-js/pull/220) ([@smithki](https://github.com/smithki))
6
+
7
+ #### 🐛 Bug Fix
8
+
9
+ - Merge with master ([@smithki](https://github.com/smithki))
10
+ - Merge branch 'master' into feat/faster-builds ([@smithki](https://github.com/smithki))
11
+ - Modify CDN default exports ([@smithki](https://github.com/smithki))
12
+ - Support newly added Magic JS extensions in ESBuild ([@smithki](https://github.com/smithki))
13
+
14
+ #### Authors: 1
15
+
16
+ - Ian K Smith ([@smithki](https://github.com/smithki))
17
+
18
+ ---
19
+
20
+ # v1.0.0 (Wed Oct 27 2021)
21
+
22
+ #### 💥 Breaking Change
23
+
24
+ - add bitcoin extension for web and react native [#233](https://github.com/magiclabs/magic-js/pull/233) ([@hcote](https://github.com/hcote))
25
+
26
+ #### Authors: 1
27
+
28
+ - Hunter Cote ([@hcote](https://github.com/hcote))
29
+
30
+ ---
31
+
package/dist/cjs/index.js CHANGED
@@ -1,81 +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.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
- options: {
66
- network: bitcoinConfig.network,
67
- }
68
- };
69
- return _this;
70
- }
71
- BitcoinExtension.prototype.signTransaction = function (txn, inputIndex) {
72
- return __awaiter(this, void 0, void 0, function () {
73
- return __generator(this, function (_a) {
74
- return [2 /*return*/, this.request(this.utils.createJsonRpcRequestPayload(types_1.BitcoinPayloadMethod.BitcoinSignTransaction, [txn, inputIndex]))];
75
- });
76
- });
77
- };
78
- return BitcoinExtension;
79
- }(magic_sdk_1.Extension.Internal));
80
- exports.BitcoinExtension = BitcoinExtension;
81
- //# sourceMappingURL=index.js.map
1
+ var b=Object.create;var o=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var g=n=>o(n,"__esModule",{value:!0});var w=(n,i)=>{g(n);for(var t in i)o(n,t,{get:i[t],enumerable:!0})},C=(n,i,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of k(i))!B.call(n,r)&&r!=="default"&&o(n,r,{get:()=>i[r],enumerable:!(t=x(i,r))||t.enumerable});return n},I=n=>C(g(o(n!=null?b(y(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var m=(n,i,t)=>new Promise((r,p)=>{var l=s=>{try{e(t.next(s))}catch(a){p(a)}},T=s=>{try{e(t.throw(s))}catch(a){p(a)}},e=s=>s.done?r(s.value):Promise.resolve(s.value).then(l,T);e((t=t.apply(n,i)).next())});w(exports,{BitcoinExtension:()=>f});var u=I(require("@magic-sdk/commons"));var c;(function(i){i.BitcoinSignTransaction="btc_signTransaction"})(c||(c={}));var f=class extends u.Extension.Internal{constructor(i){super();this.bitcoinConfig=i;this.name="bitcoin";this.config={};this.config={rpcUrl:i.rpcUrl,chainType:"BITCOIN",options:{network:i.network}}}signTransaction(i,t){return m(this,null,function*(){return this.request(this.utils.createJsonRpcRequestPayload(c.BitcoinSignTransaction,[i,t]))})}};
2
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAsC;AACtC,iCAA8D;AAE9D;IAAsC,oCAAkC;IAItE,0BAAmB,aAA4B;QAA/C,YACE,iBAAO,SASR;QAVkB,mBAAa,GAAb,aAAa,CAAe;QAH/C,UAAI,GAAG,SAAkB,CAAC;QAC1B,YAAM,GAAQ,EAAE,CAAC;QAKf,KAAI,CAAC,MAAM,GAAG;YACZ,MAAM,EAAE,aAAa,CAAC,MAAM;YAC5B,SAAS,EAAE,SAAS;YACpB,OAAO,EAAC;gBACN,OAAO,EAAE,aAAa,CAAC,OAAO;aAC/B;SACF,CAAC;;IACJ,CAAC;IAEY,0CAAe,GAA5B,UAA6B,GAAW,EAAE,UAAkB;;;gBAC1D,sBAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,2BAA2B,CAAC,4BAAoB,CAAC,sBAAsB,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAAC;;;KAC7H;IACH,uBAAC;AAAD,CAAC,AAnBD,CAAsC,qBAAS,CAAC,QAAQ,GAmBvD;AAnBY,4CAAgB"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts", "../../src/types.ts"],
4
+ "sourcesContent": ["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", "export interface BitcoinConfig {\n rpcUrl: string;\n network: string;\n}\n\nexport enum BitcoinPayloadMethod {\n BitcoinSignTransaction = 'btc_signTransaction',\n}\n"],
5
+ "mappings": "gyBAAA,0CAA0B,iCCKnB,GAAK,GAAL,UAAK,EAAL,CACL,yBAAyB,wBADf,WDFL,mBAA+B,aAAU,QAAyB,CAIvE,YAAmB,EAA8B,CAC/C,QADiB,qBAHnB,UAAO,UACP,YAAc,GAKZ,KAAK,OAAS,CACZ,OAAQ,EAAc,OACtB,UAAW,UACX,QAAS,CACP,QAAS,EAAc,UAKhB,gBAAgB,EAAa,EAAoB,gCAC5D,MAAO,MAAK,QACV,KAAK,MAAM,4BAA4B,EAAqB,uBAAwB,CAAC,EAAK",
6
+ "names": []
7
+ }
package/dist/es/index.js CHANGED
@@ -1,78 +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 { 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
- options: {
63
- network: bitcoinConfig.network,
64
- }
65
- };
66
- return _this;
67
- }
68
- BitcoinExtension.prototype.signTransaction = function (txn, inputIndex) {
69
- return __awaiter(this, void 0, void 0, function () {
70
- return __generator(this, function (_a) {
71
- return [2 /*return*/, this.request(this.utils.createJsonRpcRequestPayload(BitcoinPayloadMethod.BitcoinSignTransaction, [txn, inputIndex]))];
72
- });
73
- });
74
- };
75
- return BitcoinExtension;
76
- }(Extension.Internal));
77
- export { BitcoinExtension };
78
- //# sourceMappingURL=index.js.map
1
+ var a=(c,n,t)=>new Promise((p,e)=>{var g=i=>{try{s(t.next(i))}catch(o){e(o)}},m=i=>{try{s(t.throw(i))}catch(o){e(o)}},s=i=>i.done?p(i.value):Promise.resolve(i.value).then(g,m);s((t=t.apply(c,n)).next())});import{Extension as u}from"@magic-sdk/commons";var r;(function(n){n.BitcoinSignTransaction="btc_signTransaction"})(r||(r={}));var f=class extends u.Internal{constructor(n){super();this.bitcoinConfig=n;this.name="bitcoin";this.config={};this.config={rpcUrl:n.rpcUrl,chainType:"BITCOIN",options:{network:n.network}}}signTransaction(n,t){return a(this,null,function*(){return this.request(this.utils.createJsonRpcRequestPayload(r.BitcoinSignTransaction,[n,t]))})}};export{f as BitcoinExtension};
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,EAAiB,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE9D;IAAsC,oCAAkC;IAItE,0BAAmB,aAA4B;QAA/C,YACE,iBAAO,SASR;QAVkB,mBAAa,GAAb,aAAa,CAAe;QAH/C,UAAI,GAAG,SAAkB,CAAC;QAC1B,YAAM,GAAQ,EAAE,CAAC;QAKf,KAAI,CAAC,MAAM,GAAG;YACZ,MAAM,EAAE,aAAa,CAAC,MAAM;YAC5B,SAAS,EAAE,SAAS;YACpB,OAAO,EAAC;gBACN,OAAO,EAAE,aAAa,CAAC,OAAO;aAC/B;SACF,CAAC;;IACJ,CAAC;IAEY,0CAAe,GAA5B,UAA6B,GAAW,EAAE,UAAkB;;;gBAC1D,sBAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,2BAA2B,CAAC,oBAAoB,CAAC,sBAAsB,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,EAAC;;;KAC7H;IACH,uBAAC;AAAD,CAAC,AAnBD,CAAsC,SAAS,CAAC,QAAQ,GAmBvD"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts", "../../src/types.ts"],
4
+ "sourcesContent": ["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", "export interface BitcoinConfig {\n rpcUrl: string;\n network: string;\n}\n\nexport enum BitcoinPayloadMethod {\n BitcoinSignTransaction = 'btc_signTransaction',\n}\n"],
5
+ "mappings": "6MAAA,+CCKO,GAAK,GAAL,UAAK,EAAL,CACL,yBAAyB,wBADf,WDFL,mBAA+B,GAAU,QAAyB,CAIvE,YAAmB,EAA8B,CAC/C,QADiB,qBAHnB,UAAO,UACP,YAAc,GAKZ,KAAK,OAAS,CACZ,OAAQ,EAAc,OACtB,UAAW,UACX,QAAS,CACP,QAAS,EAAc,UAKhB,gBAAgB,EAAa,EAAoB,gCAC5D,MAAO,MAAK,QACV,KAAK,MAAM,4BAA4B,EAAqB,uBAAwB,CAAC,EAAK",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ var a=(c,n,t)=>new Promise((p,e)=>{var g=i=>{try{s(t.next(i))}catch(o){e(o)}},m=i=>{try{s(t.throw(i))}catch(o){e(o)}},s=i=>i.done?p(i.value):Promise.resolve(i.value).then(g,m);s((t=t.apply(c,n)).next())});import{Extension as u}from"@magic-sdk/commons";var r;(function(n){n.BitcoinSignTransaction="btc_signTransaction"})(r||(r={}));var f=class extends u.Internal{constructor(n){super();this.bitcoinConfig=n;this.name="bitcoin";this.config={};this.config={rpcUrl:n.rpcUrl,chainType:"BITCOIN",options:{network:n.network}}}signTransaction(n,t){return a(this,null,function*(){return this.request(this.utils.createJsonRpcRequestPayload(r.BitcoinSignTransaction,[n,t]))})}};export{f as BitcoinExtension};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts", "../../src/types.ts"],
4
+ "sourcesContent": ["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", "export interface BitcoinConfig {\n rpcUrl: string;\n network: string;\n}\n\nexport enum BitcoinPayloadMethod {\n BitcoinSignTransaction = 'btc_signTransaction',\n}\n"],
5
+ "mappings": "6MAAA,+CCKO,GAAK,GAAL,UAAK,EAAL,CACL,yBAAyB,wBADf,WDFL,mBAA+B,GAAU,QAAyB,CAIvE,YAAmB,EAA8B,CAC/C,QADiB,qBAHnB,UAAO,UACP,YAAc,GAKZ,KAAK,OAAS,CACZ,OAAQ,EAAc,OACtB,UAAW,UACX,QAAS,CACP,QAAS,EAAc,UAKhB,gBAAgB,EAAa,EAAoB,gCAC5D,MAAO,MAAK,QACV,KAAK,MAAM,4BAA4B,EAAqB,uBAAwB,CAAC,EAAK",
6
+ "names": []
7
+ }
package/dist/extension.js CHANGED
@@ -1 +1 @@
1
- var MagicBitcoinExtension=function(t){var n;return function(t){t.BitcoinSignTransaction="btc_signTransaction"}(n||(n={})),function(t){var o,r;function i(n){var o;return(o=t.call(this)||this).bitcoinConfig=n,o.name="bitcoin",o.config={},o.config={rpcUrl:n.rpcUrl,chainType:"BITCOIN",options:{network:n.network}},o}return r=t,(o=i).prototype=Object.create(r.prototype),o.prototype.constructor=o,o.__proto__=r,i.prototype.signTransaction=function(t,o){try{return Promise.resolve(this.request(this.utils.createJsonRpcRequestPayload(n.BitcoinSignTransaction,[t,o])))}catch(t){return Promise.reject(t)}},i}(t.Extension.Internal)}(Magic);
1
+ var MagicBitcoinExtension=(()=>{var b=Object.create;var a=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var m=i=>a(i,"__esModule",{value:!0});var E=(i,n)=>()=>(n||i((n={exports:{}}).exports,n),n.exports);var I=(i,n,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of k(n))!C.call(i,o)&&o!=="default"&&a(i,o,{get:()=>n[o],enumerable:!(t=y(n,o))||t.enumerable});return i},U=i=>I(m(a(i!=null?b(w(i)):{},"default",i&&i.__esModule&&"default"in i?{get:()=>i.default,enumerable:!0}:{value:i,enumerable:!0})),i);var u=(i,n,t)=>new Promise((o,g)=>{var B=r=>{try{e(t.next(r))}catch(c){g(c)}},T=r=>{try{e(t.throw(r))}catch(c){g(c)}},e=r=>r.done?o(r.value):Promise.resolve(r.value).then(B,T);e((t=t.apply(i,n)).next())});var f=E((q,x)=>{x.exports=Magic});var d={};m(d);var l=U(f());var s;(function(n){n.BitcoinSignTransaction="btc_signTransaction"})(s||(s={}));var p=class extends l.Extension.Internal{constructor(n){super();this.bitcoinConfig=n;this.name="bitcoin";this.config={};this.config={rpcUrl:n.rpcUrl,chainType:"BITCOIN",options:{network:n.network}}}signTransaction(n,t){return u(this,null,function*(){return this.request(this.utils.createJsonRpcRequestPayload(s.BitcoinSignTransaction,[n,t]))})}};module.exports=p;return d;})();
@@ -0,0 +1,2 @@
1
+ var b=Object.create;var o=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var g=n=>o(n,"__esModule",{value:!0});var w=(n,i)=>{g(n);for(var t in i)o(n,t,{get:i[t],enumerable:!0})},C=(n,i,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of k(i))!B.call(n,r)&&r!=="default"&&o(n,r,{get:()=>i[r],enumerable:!(t=x(i,r))||t.enumerable});return n},I=n=>C(g(o(n!=null?b(y(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);var m=(n,i,t)=>new Promise((r,p)=>{var l=s=>{try{e(t.next(s))}catch(a){p(a)}},T=s=>{try{e(t.throw(s))}catch(a){p(a)}},e=s=>s.done?r(s.value):Promise.resolve(s.value).then(l,T);e((t=t.apply(n,i)).next())});w(exports,{BitcoinExtension:()=>f});var u=I(require("@magic-sdk/commons"));var c;(function(i){i.BitcoinSignTransaction="btc_signTransaction"})(c||(c={}));var f=class extends u.Extension.Internal{constructor(i){super();this.bitcoinConfig=i;this.name="bitcoin";this.config={};this.config={rpcUrl:i.rpcUrl,chainType:"BITCOIN",options:{network:i.network}}}signTransaction(i,t){return m(this,null,function*(){return this.request(this.utils.createJsonRpcRequestPayload(c.BitcoinSignTransaction,[i,t]))})}};
2
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts", "../../src/types.ts"],
4
+ "sourcesContent": ["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", "export interface BitcoinConfig {\n rpcUrl: string;\n network: string;\n}\n\nexport enum BitcoinPayloadMethod {\n BitcoinSignTransaction = 'btc_signTransaction',\n}\n"],
5
+ "mappings": "gyBAAA,0CAA0B,iCCKnB,GAAK,GAAL,UAAK,EAAL,CACL,yBAAyB,wBADf,WDFL,mBAA+B,aAAU,QAAyB,CAIvE,YAAmB,EAA8B,CAC/C,QADiB,qBAHnB,UAAO,UACP,YAAc,GAKZ,KAAK,OAAS,CACZ,OAAQ,EAAc,OACtB,UAAW,UACX,QAAS,CACP,QAAS,EAAc,UAKhB,gBAAgB,EAAa,EAAoB,gCAC5D,MAAO,MAAK,QACV,KAAK,MAAM,4BAA4B,EAAqB,uBAAwB,CAAC,EAAK",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ import { BitcoinExtension } from './index';
2
+ export type { BitcoinExtension as default };
@@ -1,4 +1,4 @@
1
- import { Extension } from 'magic-sdk';
1
+ import { Extension } from '@magic-sdk/commons';
2
2
  import { BitcoinConfig } from './types';
3
3
  export declare class BitcoinExtension extends Extension.Internal<'bitcoin', any> {
4
4
  bitcoinConfig: BitcoinConfig;
@@ -0,0 +1 @@
1
+ export * from './index';
File without changes
package/package.json CHANGED
@@ -1,51 +1,34 @@
1
1
  {
2
2
  "name": "@magic-ext/bitcoin",
3
- "version": "0.1.2",
3
+ "version": "3.0.0",
4
4
  "description": "magic bitcoin 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": "MagicBitcoinExtension",
17
- "main": "dist/cjs/index.js",
18
- "umd:main": "dist/extension.js",
19
- "jsdelivr": "dist/extension.js",
20
- "module": "dist/es/index.js",
21
- "types": "dist/cjs/index.d.ts",
22
- "devDependencies": {
23
- "magic-sdk": "^2.6.0"
24
- },
25
- "ava": {
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": "neutral",
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/es/index.mjs",
23
+ "require": "./dist/cjs/index.js"
37
24
  },
38
- "nyc": {
39
- "extends": "@istanbuljs/nyc-config-typescript",
40
- "all": false,
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": "^4.0.0"
32
+ },
33
+ "gitHead": "5a1afc093cfec98bdcfb232cb2878510014da70a"
51
34
  }
@@ -1,2 +0,0 @@
1
- import { BitcoinExtension } from './index';
2
- export { BitcoinExtension as default };
@@ -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"}
@@ -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: string, inputIndex: number): 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
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAKA,IAAY,oBAEX;AAFD,WAAY,oBAAoB;IAC5B,sEAA8C,CAAA;AAClD,CAAC,EAFW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAE/B"}
@@ -1,2 +0,0 @@
1
- import { BitcoinExtension } from './index';
2
- export { BitcoinExtension as default };
@@ -1,3 +0,0 @@
1
- import { BitcoinExtension } from './index';
2
- export { BitcoinExtension 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,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,gBAAgB,IAAI,OAAO,EAAE,CAAC"}
@@ -1,7 +0,0 @@
1
- export interface BitcoinConfig {
2
- rpcUrl: string;
3
- network: string;
4
- }
5
- export declare enum BitcoinPayloadMethod {
6
- BitcoinSignTransaction = "btc_signTransaction"
7
- }
package/dist/es/types.js DELETED
@@ -1,5 +0,0 @@
1
- export var BitcoinPayloadMethod;
2
- (function (BitcoinPayloadMethod) {
3
- BitcoinPayloadMethod["BitcoinSignTransaction"] = "btc_signTransaction";
4
- })(BitcoinPayloadMethod || (BitcoinPayloadMethod = {}));
5
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAKA,MAAM,CAAN,IAAY,oBAEX;AAFD,WAAY,oBAAoB;IAC5B,sEAA8C,CAAA;AAClD,CAAC,EAFW,oBAAoB,KAApB,oBAAoB,QAE/B"}