@lucid-evolution/provider 0.1.26 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +15 -25
- package/dist/index.js +15 -25
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -39,7 +39,7 @@ __export(src_exports, {
|
|
|
39
39
|
module.exports = __toCommonJS(src_exports);
|
|
40
40
|
|
|
41
41
|
// src/core.ts
|
|
42
|
-
var CML = __toESM(require("@
|
|
42
|
+
var CML = __toESM(require("@anastasia-labs/cardano-multiplatform-lib-nodejs"), 1);
|
|
43
43
|
|
|
44
44
|
// src/blockfrost.ts
|
|
45
45
|
var import_core_utils = require("@lucid-evolution/core-utils");
|
|
@@ -48,7 +48,7 @@ var import_utils = require("@lucid-evolution/utils");
|
|
|
48
48
|
// package.json
|
|
49
49
|
var package_default = {
|
|
50
50
|
name: "@lucid-evolution/provider",
|
|
51
|
-
version: "0.1.
|
|
51
|
+
version: "0.1.27",
|
|
52
52
|
description: "",
|
|
53
53
|
main: "./dist/index.js",
|
|
54
54
|
types: "./dist/index.d.ts",
|
|
@@ -75,11 +75,11 @@ var package_default = {
|
|
|
75
75
|
author: "",
|
|
76
76
|
license: "MIT",
|
|
77
77
|
browser: {
|
|
78
|
-
"@
|
|
78
|
+
"@anastasia-labs/cardano-multiplatform-lib-nodejs": "@anastasia-labs/cardano-multiplatform-lib-browser"
|
|
79
79
|
},
|
|
80
80
|
dependencies: {
|
|
81
|
-
"@
|
|
82
|
-
"@
|
|
81
|
+
"@anastasia-labs/cardano-multiplatform-lib-browser": "^5.3.1-2",
|
|
82
|
+
"@anastasia-labs/cardano-multiplatform-lib-nodejs": "^5.3.1-2",
|
|
83
83
|
"@effect/schema": "^0.67.16",
|
|
84
84
|
"@lucid-evolution/core-types": "workspace:*",
|
|
85
85
|
"@lucid-evolution/core-utils": "workspace:*",
|
|
@@ -125,8 +125,7 @@ var Blockfrost = class {
|
|
|
125
125
|
}
|
|
126
126
|
async getUtxos(addressOrCredential) {
|
|
127
127
|
const queryPredicate = (() => {
|
|
128
|
-
if (typeof addressOrCredential === "string")
|
|
129
|
-
return addressOrCredential;
|
|
128
|
+
if (typeof addressOrCredential === "string") return addressOrCredential;
|
|
130
129
|
const credentialBech32 = addressOrCredential.type === "Key" ? CML.Ed25519KeyHash.from_hex(addressOrCredential.hash).to_bech32(
|
|
131
130
|
"addr_vkh"
|
|
132
131
|
) : CML.ScriptHash.from_hex(addressOrCredential.hash).to_bech32(
|
|
@@ -149,16 +148,14 @@ var Blockfrost = class {
|
|
|
149
148
|
}
|
|
150
149
|
}
|
|
151
150
|
result = result.concat(pageResult);
|
|
152
|
-
if (pageResult.length <= 0)
|
|
153
|
-
break;
|
|
151
|
+
if (pageResult.length <= 0) break;
|
|
154
152
|
page++;
|
|
155
153
|
}
|
|
156
154
|
return this.blockfrostUtxosToUtxos(result);
|
|
157
155
|
}
|
|
158
156
|
async getUtxosWithUnit(addressOrCredential, unit) {
|
|
159
157
|
const queryPredicate = (() => {
|
|
160
|
-
if (typeof addressOrCredential === "string")
|
|
161
|
-
return addressOrCredential;
|
|
158
|
+
if (typeof addressOrCredential === "string") return addressOrCredential;
|
|
162
159
|
const credentialBech32 = addressOrCredential.type === "Key" ? CML.Ed25519KeyHash.from_hex(addressOrCredential.hash).to_bech32(
|
|
163
160
|
"addr_vkh"
|
|
164
161
|
) : CML.ScriptHash.from_hex(addressOrCredential.hash).to_bech32(
|
|
@@ -181,8 +178,7 @@ var Blockfrost = class {
|
|
|
181
178
|
}
|
|
182
179
|
}
|
|
183
180
|
result = result.concat(pageResult);
|
|
184
|
-
if (pageResult.length <= 0)
|
|
185
|
-
break;
|
|
181
|
+
if (pageResult.length <= 0) break;
|
|
186
182
|
page++;
|
|
187
183
|
}
|
|
188
184
|
return this.blockfrostUtxosToUtxos(result);
|
|
@@ -276,10 +272,8 @@ var Blockfrost = class {
|
|
|
276
272
|
body: (0, import_core_utils.fromHex)(tx)
|
|
277
273
|
}).then((res) => res.json());
|
|
278
274
|
if (!result || result.error) {
|
|
279
|
-
if (result?.status_code === 400)
|
|
280
|
-
|
|
281
|
-
else
|
|
282
|
-
throw new Error("Could not submit transaction.");
|
|
275
|
+
if (result?.status_code === 400) throw new Error(result.message);
|
|
276
|
+
else throw new Error("Could not submit transaction.");
|
|
283
277
|
}
|
|
284
278
|
return result;
|
|
285
279
|
}
|
|
@@ -516,10 +510,8 @@ var Kupmios = class {
|
|
|
516
510
|
(msg) => {
|
|
517
511
|
try {
|
|
518
512
|
const { result } = JSON.parse(msg.data);
|
|
519
|
-
if (result.transaction)
|
|
520
|
-
|
|
521
|
-
else
|
|
522
|
-
rej(result.error);
|
|
513
|
+
if (result.transaction) res(result.transaction.id);
|
|
514
|
+
else rej(result.error);
|
|
523
515
|
client.close();
|
|
524
516
|
} catch (e) {
|
|
525
517
|
rej(e);
|
|
@@ -789,8 +781,7 @@ var Maestro = class {
|
|
|
789
781
|
});
|
|
790
782
|
const result = await response.text();
|
|
791
783
|
if (!response.ok) {
|
|
792
|
-
if (response.status === 400)
|
|
793
|
-
throw new Error(result);
|
|
784
|
+
if (response.status === 400) throw new Error(result);
|
|
794
785
|
else {
|
|
795
786
|
throw new Error(
|
|
796
787
|
"Could not submit transaction. Received status code: " + response.status
|
|
@@ -841,8 +832,7 @@ var Maestro = class {
|
|
|
841
832
|
}
|
|
842
833
|
nextCursor = pageResult.next_cursor;
|
|
843
834
|
result = result.concat(pageResult.data);
|
|
844
|
-
if (nextCursor == null)
|
|
845
|
-
break;
|
|
835
|
+
if (nextCursor == null) break;
|
|
846
836
|
}
|
|
847
837
|
return result;
|
|
848
838
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/core.ts
|
|
2
|
-
import * as CML from "@
|
|
2
|
+
import * as CML from "@anastasia-labs/cardano-multiplatform-lib-nodejs";
|
|
3
3
|
|
|
4
4
|
// src/blockfrost.ts
|
|
5
5
|
import { fromHex } from "@lucid-evolution/core-utils";
|
|
@@ -8,7 +8,7 @@ import { applyDoubleCborEncoding } from "@lucid-evolution/utils";
|
|
|
8
8
|
// package.json
|
|
9
9
|
var package_default = {
|
|
10
10
|
name: "@lucid-evolution/provider",
|
|
11
|
-
version: "0.1.
|
|
11
|
+
version: "0.1.27",
|
|
12
12
|
description: "",
|
|
13
13
|
main: "./dist/index.js",
|
|
14
14
|
types: "./dist/index.d.ts",
|
|
@@ -35,11 +35,11 @@ var package_default = {
|
|
|
35
35
|
author: "",
|
|
36
36
|
license: "MIT",
|
|
37
37
|
browser: {
|
|
38
|
-
"@
|
|
38
|
+
"@anastasia-labs/cardano-multiplatform-lib-nodejs": "@anastasia-labs/cardano-multiplatform-lib-browser"
|
|
39
39
|
},
|
|
40
40
|
dependencies: {
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
41
|
+
"@anastasia-labs/cardano-multiplatform-lib-browser": "^5.3.1-2",
|
|
42
|
+
"@anastasia-labs/cardano-multiplatform-lib-nodejs": "^5.3.1-2",
|
|
43
43
|
"@effect/schema": "^0.67.16",
|
|
44
44
|
"@lucid-evolution/core-types": "workspace:*",
|
|
45
45
|
"@lucid-evolution/core-utils": "workspace:*",
|
|
@@ -85,8 +85,7 @@ var Blockfrost = class {
|
|
|
85
85
|
}
|
|
86
86
|
async getUtxos(addressOrCredential) {
|
|
87
87
|
const queryPredicate = (() => {
|
|
88
|
-
if (typeof addressOrCredential === "string")
|
|
89
|
-
return addressOrCredential;
|
|
88
|
+
if (typeof addressOrCredential === "string") return addressOrCredential;
|
|
90
89
|
const credentialBech32 = addressOrCredential.type === "Key" ? CML.Ed25519KeyHash.from_hex(addressOrCredential.hash).to_bech32(
|
|
91
90
|
"addr_vkh"
|
|
92
91
|
) : CML.ScriptHash.from_hex(addressOrCredential.hash).to_bech32(
|
|
@@ -109,16 +108,14 @@ var Blockfrost = class {
|
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
110
|
result = result.concat(pageResult);
|
|
112
|
-
if (pageResult.length <= 0)
|
|
113
|
-
break;
|
|
111
|
+
if (pageResult.length <= 0) break;
|
|
114
112
|
page++;
|
|
115
113
|
}
|
|
116
114
|
return this.blockfrostUtxosToUtxos(result);
|
|
117
115
|
}
|
|
118
116
|
async getUtxosWithUnit(addressOrCredential, unit) {
|
|
119
117
|
const queryPredicate = (() => {
|
|
120
|
-
if (typeof addressOrCredential === "string")
|
|
121
|
-
return addressOrCredential;
|
|
118
|
+
if (typeof addressOrCredential === "string") return addressOrCredential;
|
|
122
119
|
const credentialBech32 = addressOrCredential.type === "Key" ? CML.Ed25519KeyHash.from_hex(addressOrCredential.hash).to_bech32(
|
|
123
120
|
"addr_vkh"
|
|
124
121
|
) : CML.ScriptHash.from_hex(addressOrCredential.hash).to_bech32(
|
|
@@ -141,8 +138,7 @@ var Blockfrost = class {
|
|
|
141
138
|
}
|
|
142
139
|
}
|
|
143
140
|
result = result.concat(pageResult);
|
|
144
|
-
if (pageResult.length <= 0)
|
|
145
|
-
break;
|
|
141
|
+
if (pageResult.length <= 0) break;
|
|
146
142
|
page++;
|
|
147
143
|
}
|
|
148
144
|
return this.blockfrostUtxosToUtxos(result);
|
|
@@ -236,10 +232,8 @@ var Blockfrost = class {
|
|
|
236
232
|
body: fromHex(tx)
|
|
237
233
|
}).then((res) => res.json());
|
|
238
234
|
if (!result || result.error) {
|
|
239
|
-
if (result?.status_code === 400)
|
|
240
|
-
|
|
241
|
-
else
|
|
242
|
-
throw new Error("Could not submit transaction.");
|
|
235
|
+
if (result?.status_code === 400) throw new Error(result.message);
|
|
236
|
+
else throw new Error("Could not submit transaction.");
|
|
243
237
|
}
|
|
244
238
|
return result;
|
|
245
239
|
}
|
|
@@ -476,10 +470,8 @@ var Kupmios = class {
|
|
|
476
470
|
(msg) => {
|
|
477
471
|
try {
|
|
478
472
|
const { result } = JSON.parse(msg.data);
|
|
479
|
-
if (result.transaction)
|
|
480
|
-
|
|
481
|
-
else
|
|
482
|
-
rej(result.error);
|
|
473
|
+
if (result.transaction) res(result.transaction.id);
|
|
474
|
+
else rej(result.error);
|
|
483
475
|
client.close();
|
|
484
476
|
} catch (e) {
|
|
485
477
|
rej(e);
|
|
@@ -749,8 +741,7 @@ var Maestro = class {
|
|
|
749
741
|
});
|
|
750
742
|
const result = await response.text();
|
|
751
743
|
if (!response.ok) {
|
|
752
|
-
if (response.status === 400)
|
|
753
|
-
throw new Error(result);
|
|
744
|
+
if (response.status === 400) throw new Error(result);
|
|
754
745
|
else {
|
|
755
746
|
throw new Error(
|
|
756
747
|
"Could not submit transaction. Received status code: " + response.status
|
|
@@ -801,8 +792,7 @@ var Maestro = class {
|
|
|
801
792
|
}
|
|
802
793
|
nextCursor = pageResult.next_cursor;
|
|
803
794
|
result = result.concat(pageResult.data);
|
|
804
|
-
if (nextCursor == null)
|
|
805
|
-
break;
|
|
795
|
+
if (nextCursor == null) break;
|
|
806
796
|
}
|
|
807
797
|
return result;
|
|
808
798
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lucid-evolution/provider",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"author": "",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"browser": {
|
|
25
|
-
"@
|
|
25
|
+
"@anastasia-labs/cardano-multiplatform-lib-nodejs": "@anastasia-labs/cardano-multiplatform-lib-browser"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@
|
|
28
|
+
"@anastasia-labs/cardano-multiplatform-lib-browser": "^5.3.1-2",
|
|
29
|
+
"@anastasia-labs/cardano-multiplatform-lib-nodejs": "^5.3.1-2",
|
|
30
30
|
"@effect/schema": "^0.67.16",
|
|
31
31
|
"effect": "^3.1.2",
|
|
32
|
-
"@lucid-evolution/core-types": "0.1.
|
|
33
|
-
"@lucid-evolution/core-utils": "0.1.
|
|
34
|
-
"@lucid-evolution/utils": "0.1.
|
|
32
|
+
"@lucid-evolution/core-types": "0.1.8",
|
|
33
|
+
"@lucid-evolution/core-utils": "0.1.7",
|
|
34
|
+
"@lucid-evolution/utils": "0.1.20"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^20.12.8",
|