ecash-agora 4.1.0-rc2 → 4.1.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/package.json +49 -49
- package/tests/oneshot.test.ts +0 -18
- package/tests/partial.alp.test.ts +0 -12
- package/tests/partial.slp.test.ts +0 -6
package/package.json
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
2
|
+
"name": "ecash-agora",
|
|
3
|
+
"version": "4.1.0",
|
|
4
|
+
"description": "Library for interacting with the eCash Agora protocol",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Bitcoin-ABC/bitcoin-abc.git",
|
|
9
|
+
"directory": "modules/ecash-agora"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"ecash",
|
|
13
|
+
"xec",
|
|
14
|
+
"bitcoin"
|
|
15
|
+
],
|
|
16
|
+
"author": "Bitcoin ABC",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/Bitcoin-ABC/bitcoin-abc/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/Bitcoin-ABC/bitcoin-abc#readme",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
24
|
+
"@types/chai": "^4.3.14",
|
|
25
|
+
"@types/chai-as-promised": "^7.1.8",
|
|
26
|
+
"@types/mocha": "^10.0.10",
|
|
27
|
+
"@types/node": "^20.12.7",
|
|
28
|
+
"chai": "^4.4.1",
|
|
29
|
+
"chai-as-promised": "^7.1.1",
|
|
30
|
+
"mocha": "^11.7.5",
|
|
31
|
+
"mocha-junit-reporter": "^2.2.1",
|
|
32
|
+
"nyc": "^15.1.0",
|
|
33
|
+
"source-map-support": "^0.5.21",
|
|
34
|
+
"ts-node": "^10.9.2",
|
|
35
|
+
"tsx": "^4.7.2",
|
|
36
|
+
"typescript": "^5.9.3"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"chronik-client": "^4.2.0",
|
|
40
|
+
"ecash-lib": "^4.12.0",
|
|
41
|
+
"ecash-wallet": "^5.4.1"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc && tsc -p ./tsconfig.build.json",
|
|
45
|
+
"test": "mocha --import=tsx ./src/*.test.ts ./src/**/*.test.ts",
|
|
46
|
+
"integration-tests": "mocha --import=tsx ./tests/*.test.ts --timeout 60000",
|
|
47
|
+
"coverage": "nyc npm run test",
|
|
48
|
+
"junit": "npm run test --reporter mocha-junit-reporter"
|
|
49
|
+
}
|
|
50
|
+
}
|
package/tests/oneshot.test.ts
CHANGED
|
@@ -1090,9 +1090,6 @@ describe('SLP', () => {
|
|
|
1090
1090
|
expect(listResult.success).to.equal(true);
|
|
1091
1091
|
expect(listResult.broadcasted.length).to.equal(2);
|
|
1092
1092
|
|
|
1093
|
-
// Wait for offer to be indexed
|
|
1094
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1095
|
-
|
|
1096
1093
|
// Find the offer
|
|
1097
1094
|
const offers = await agora.activeOffersByTokenId(childTokenId);
|
|
1098
1095
|
expect(offers.length).to.equal(1);
|
|
@@ -1113,7 +1110,6 @@ describe('SLP', () => {
|
|
|
1113
1110
|
expect(takeResult.broadcasted.length).to.equal(1);
|
|
1114
1111
|
|
|
1115
1112
|
// Verify offer is no longer active
|
|
1116
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1117
1113
|
const remainingOffers = await agora.activeOffersByTokenId(childTokenId);
|
|
1118
1114
|
expect(remainingOffers.length).to.equal(0);
|
|
1119
1115
|
});
|
|
@@ -1225,18 +1221,12 @@ describe('SLP', () => {
|
|
|
1225
1221
|
|
|
1226
1222
|
expect(listResult.success).to.equal(true);
|
|
1227
1223
|
expect(listResult.broadcasted.length).to.equal(2);
|
|
1228
|
-
// Align with chain again before minting/listing another NFT from this wallet.
|
|
1229
|
-
await new Promise(resolve => setTimeout(resolve, 500));
|
|
1230
1224
|
await sellerWallet.sync();
|
|
1231
1225
|
return cid;
|
|
1232
1226
|
}
|
|
1233
1227
|
|
|
1234
1228
|
const childTokenIdA = await mintChildListing('TST NFT A', 30000n);
|
|
1235
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1236
|
-
|
|
1237
1229
|
const childTokenIdB = await mintChildListing('TST NFT B', 28000n);
|
|
1238
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1239
|
-
|
|
1240
1230
|
await runner.sendToScript(90000n, Script.p2pkh(shaRmd160(buyerPk)));
|
|
1241
1231
|
await buyerWallet.sync();
|
|
1242
1232
|
|
|
@@ -1250,7 +1240,6 @@ describe('SLP', () => {
|
|
|
1250
1240
|
expect(takeAResult.success).to.equal(true);
|
|
1251
1241
|
expect(takeAResult.broadcasted.length).to.equal(1);
|
|
1252
1242
|
|
|
1253
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1254
1243
|
const offersB = await agora.activeOffersByTokenId(childTokenIdB);
|
|
1255
1244
|
expect(offersB.length).to.equal(1);
|
|
1256
1245
|
const takeBResult = await offersB[0].take({
|
|
@@ -1261,7 +1250,6 @@ describe('SLP', () => {
|
|
|
1261
1250
|
expect(takeBResult.success).to.equal(true);
|
|
1262
1251
|
expect(takeBResult.broadcasted.length).to.equal(1);
|
|
1263
1252
|
|
|
1264
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1265
1253
|
expect(
|
|
1266
1254
|
(await agora.activeOffersByTokenId(childTokenIdA)).length,
|
|
1267
1255
|
).to.equal(0);
|
|
@@ -1370,9 +1358,6 @@ describe('SLP', () => {
|
|
|
1370
1358
|
expect(listResult.success).to.equal(true);
|
|
1371
1359
|
expect(listResult.broadcasted.length).to.equal(2);
|
|
1372
1360
|
|
|
1373
|
-
// Wait for offer to be indexed
|
|
1374
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1375
|
-
|
|
1376
1361
|
// Find the offer
|
|
1377
1362
|
const offers = await agora.activeOffersByTokenId(childTokenId);
|
|
1378
1363
|
expect(offers.length).to.equal(1);
|
|
@@ -1391,7 +1376,6 @@ describe('SLP', () => {
|
|
|
1391
1376
|
expect(cancelResult.broadcasted.length).to.equal(1);
|
|
1392
1377
|
|
|
1393
1378
|
// Verify offer is no longer active
|
|
1394
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1395
1379
|
const remainingOffers = await agora.activeOffersByTokenId(childTokenId);
|
|
1396
1380
|
expect(remainingOffers.length).to.equal(0);
|
|
1397
1381
|
});
|
|
@@ -1495,7 +1479,6 @@ describe('SLP', () => {
|
|
|
1495
1479
|
expect(listResult.success).to.equal(true);
|
|
1496
1480
|
expect(listResult.broadcasted.length).to.equal(2);
|
|
1497
1481
|
|
|
1498
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1499
1482
|
const offers = await agora.activeOffersByTokenId(childTokenId);
|
|
1500
1483
|
expect(offers.length).to.equal(1);
|
|
1501
1484
|
|
|
@@ -1505,7 +1488,6 @@ describe('SLP', () => {
|
|
|
1505
1488
|
expect(cancelResult.success).to.equal(true);
|
|
1506
1489
|
expect(cancelResult.broadcasted.length).to.equal(1);
|
|
1507
1490
|
|
|
1508
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1509
1491
|
expect(
|
|
1510
1492
|
(await agora.activeOffersByTokenId(childTokenId)).length,
|
|
1511
1493
|
).to.equal(0);
|
|
@@ -913,9 +913,6 @@ describe('AgoraPartial ALP', () => {
|
|
|
913
913
|
expect(listResult.success).to.equal(true);
|
|
914
914
|
expect(listResult.broadcasted.length).to.equal(1);
|
|
915
915
|
|
|
916
|
-
// Wait for offer to be indexed
|
|
917
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
918
|
-
|
|
919
916
|
// Find the offer
|
|
920
917
|
const offers = await agora.activeOffersByTokenId(tokenId);
|
|
921
918
|
expect(offers.length).to.equal(1);
|
|
@@ -938,7 +935,6 @@ describe('AgoraPartial ALP', () => {
|
|
|
938
935
|
expect(takeResult.broadcasted.length).to.equal(1);
|
|
939
936
|
|
|
940
937
|
// Verify offer is still active (partial accept leaves remainder)
|
|
941
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
942
938
|
const remainingOffers = await agora.activeOffersByTokenId(tokenId);
|
|
943
939
|
expect(remainingOffers.length).to.equal(1);
|
|
944
940
|
expect(remainingOffers[0].token.atoms).to.equal(
|
|
@@ -1019,9 +1015,6 @@ describe('AgoraPartial ALP', () => {
|
|
|
1019
1015
|
expect(listResult.success).to.equal(true);
|
|
1020
1016
|
expect(listResult.broadcasted.length).to.equal(1);
|
|
1021
1017
|
|
|
1022
|
-
// Wait for offer to be indexed
|
|
1023
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1024
|
-
|
|
1025
1018
|
// Find the offer
|
|
1026
1019
|
const offers = await agora.activeOffersByTokenId(tokenId);
|
|
1027
1020
|
expect(offers.length).to.equal(1);
|
|
@@ -1040,7 +1033,6 @@ describe('AgoraPartial ALP', () => {
|
|
|
1040
1033
|
expect(cancelResult.broadcasted.length).to.equal(1);
|
|
1041
1034
|
|
|
1042
1035
|
// Verify offer is no longer active
|
|
1043
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1044
1036
|
const remainingOffers = await agora.activeOffersByTokenId(tokenId);
|
|
1045
1037
|
expect(remainingOffers.length).to.equal(0);
|
|
1046
1038
|
});
|
|
@@ -1113,7 +1105,6 @@ describe('AgoraPartial ALP', () => {
|
|
|
1113
1105
|
expect(listResult.success).to.equal(true);
|
|
1114
1106
|
expect(listResult.broadcasted.length).to.equal(1);
|
|
1115
1107
|
|
|
1116
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1117
1108
|
const offers = await agora.activeOffersByTokenId(tokenId);
|
|
1118
1109
|
expect(offers.length).to.equal(1);
|
|
1119
1110
|
const offer = offers[0];
|
|
@@ -1124,7 +1115,6 @@ describe('AgoraPartial ALP', () => {
|
|
|
1124
1115
|
expect(cancelResult.success).to.equal(true);
|
|
1125
1116
|
expect(cancelResult.broadcasted.length).to.equal(1);
|
|
1126
1117
|
|
|
1127
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1128
1118
|
expect((await agora.activeOffersByTokenId(tokenId)).length).to.equal(0);
|
|
1129
1119
|
});
|
|
1130
1120
|
|
|
@@ -1195,7 +1185,6 @@ describe('AgoraPartial ALP', () => {
|
|
|
1195
1185
|
});
|
|
1196
1186
|
expect(listResult.success).to.equal(true);
|
|
1197
1187
|
|
|
1198
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1199
1188
|
const offers = await agora.activeOffersByTokenId(tokenId);
|
|
1200
1189
|
expect(offers.length).to.equal(1);
|
|
1201
1190
|
const offer = offers[0];
|
|
@@ -1219,7 +1208,6 @@ describe('AgoraPartial ALP', () => {
|
|
|
1219
1208
|
});
|
|
1220
1209
|
expect(relistResult.success).to.equal(true);
|
|
1221
1210
|
|
|
1222
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1223
1211
|
expect((await agora.activeOffersByTokenId(tokenId)).length).to.equal(1);
|
|
1224
1212
|
});
|
|
1225
1213
|
});
|
|
@@ -888,7 +888,6 @@ describe('AgoraPartial SLP', () => {
|
|
|
888
888
|
expect(takeResult.broadcasted.length).to.equal(1);
|
|
889
889
|
|
|
890
890
|
// Verify offer is still active (partial accept leaves remainder)
|
|
891
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
892
891
|
const remainingOffers = await agora.activeOffersByTokenId(tokenId);
|
|
893
892
|
expect(remainingOffers.length).to.equal(1);
|
|
894
893
|
expect(remainingOffers[0].token.atoms).to.equal(
|
|
@@ -960,7 +959,6 @@ describe('AgoraPartial SLP', () => {
|
|
|
960
959
|
expect(listResult.success).to.equal(true);
|
|
961
960
|
expect(listResult.broadcasted.length).to.equal(2);
|
|
962
961
|
|
|
963
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
964
962
|
const offers = await agora.activeOffersByTokenId(tokenId);
|
|
965
963
|
expect(offers.length).to.equal(1);
|
|
966
964
|
|
|
@@ -994,7 +992,6 @@ describe('AgoraPartial SLP', () => {
|
|
|
994
992
|
expect(secondTakeResult.success).to.equal(true);
|
|
995
993
|
expect(secondTakeResult.broadcasted.length).to.equal(1);
|
|
996
994
|
|
|
997
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
998
995
|
const offersAfterSecondTake =
|
|
999
996
|
await agora.activeOffersByTokenId(tokenId);
|
|
1000
997
|
expect(offersAfterSecondTake.length).to.equal(0);
|
|
@@ -1084,7 +1081,6 @@ describe('AgoraPartial SLP', () => {
|
|
|
1084
1081
|
expect(cancelResult.broadcasted.length).to.equal(1);
|
|
1085
1082
|
|
|
1086
1083
|
// Verify offer is no longer active
|
|
1087
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1088
1084
|
const remainingOffers = await agora.activeOffersByTokenId(tokenId);
|
|
1089
1085
|
expect(remainingOffers.length).to.equal(0);
|
|
1090
1086
|
});
|
|
@@ -1150,7 +1146,6 @@ describe('AgoraPartial SLP', () => {
|
|
|
1150
1146
|
expect(listResult.success).to.equal(true);
|
|
1151
1147
|
expect(listResult.broadcasted.length).to.equal(2);
|
|
1152
1148
|
|
|
1153
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1154
1149
|
const offers = await agora.activeOffersByTokenId(tokenId);
|
|
1155
1150
|
expect(offers.length).to.equal(1);
|
|
1156
1151
|
|
|
@@ -1160,7 +1155,6 @@ describe('AgoraPartial SLP', () => {
|
|
|
1160
1155
|
expect(cancelResult.success).to.equal(true);
|
|
1161
1156
|
expect(cancelResult.broadcasted.length).to.equal(1);
|
|
1162
1157
|
|
|
1163
|
-
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1164
1158
|
expect((await agora.activeOffersByTokenId(tokenId)).length).to.equal(0);
|
|
1165
1159
|
});
|
|
1166
1160
|
});
|