@airgap/coinlib-core 0.13.6-beta.5 → 0.13.6-beta.7
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/airgap-coinlib-core.min.js +1245 -2800
- package/index.d.ts +3 -3
- package/index.js +4 -5
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/protocols/tezos/TezosProtocol.d.ts +3 -19
- package/protocols/tezos/TezosProtocol.js +25 -365
- package/protocols/tezos/TezosProtocol.js.map +1 -1
- package/protocols/tezos/TezosProtocolOptions.d.ts +4 -6
- package/protocols/tezos/TezosProtocolOptions.js +4 -18
- package/protocols/tezos/TezosProtocolOptions.js.map +1 -1
- package/protocols/tezos/contract/TezosContract.d.ts +9 -7
- package/protocols/tezos/contract/TezosContract.js +63 -84
- package/protocols/tezos/contract/TezosContract.js.map +1 -1
- package/protocols/tezos/contract/TezosContractEntrypoint.js +1 -1
- package/protocols/tezos/contract/TezosContractEntrypoint.js.map +1 -1
- package/protocols/tezos/domains/TezosDomains.d.ts +2 -2
- package/protocols/tezos/domains/TezosDomains.js +36 -27
- package/protocols/tezos/domains/TezosDomains.js.map +1 -1
- package/protocols/tezos/fa/TezosBTC.d.ts +0 -1
- package/protocols/tezos/fa/TezosBTC.js +1 -43
- package/protocols/tezos/fa/TezosBTC.js.map +1 -1
- package/protocols/tezos/fa/TezosETHtz.d.ts +0 -1
- package/protocols/tezos/fa/TezosETHtz.js +1 -40
- package/protocols/tezos/fa/TezosETHtz.js.map +1 -1
- package/protocols/tezos/fa/TezosFA1Protocol.js +1 -2
- package/protocols/tezos/fa/TezosFA1Protocol.js.map +1 -1
- package/protocols/tezos/fa/TezosFA2Protocol.d.ts +0 -3
- package/protocols/tezos/fa/TezosFA2Protocol.js +31 -108
- package/protocols/tezos/fa/TezosFA2Protocol.js.map +1 -1
- package/protocols/tezos/fa/TezosFAProtocol.d.ts +2 -6
- package/protocols/tezos/fa/TezosFAProtocol.js +29 -167
- package/protocols/tezos/fa/TezosFAProtocol.js.map +1 -1
- package/protocols/tezos/fa/TezosKolibriUSD.d.ts +0 -1
- package/protocols/tezos/fa/TezosKolibriUSD.js +1 -40
- package/protocols/tezos/fa/TezosKolibriUSD.js.map +1 -1
- package/protocols/tezos/fa/TezosStaker.js +1 -15
- package/protocols/tezos/fa/TezosStaker.js.map +1 -1
- package/protocols/tezos/fa/TezosUSD.d.ts +0 -1
- package/protocols/tezos/fa/TezosUSD.js +1 -38
- package/protocols/tezos/fa/TezosUSD.js.map +1 -1
- package/protocols/tezos/fa/TezosWrapped.js +1 -36
- package/protocols/tezos/fa/TezosWrapped.js.map +1 -1
- package/protocols/tezos/indexerClient/TezosIndexerClient.d.ts +25 -0
- package/protocols/tezos/indexerClient/TezosIndexerClient.js +245 -0
- package/protocols/tezos/indexerClient/TezosIndexerClient.js.map +1 -0
- package/protocols/tezos/indexerClient/TezosProtocolIndexerClient.d.ts +26 -0
- package/protocols/tezos/indexerClient/TezosProtocolIndexerClient.js +3 -0
- package/protocols/tezos/indexerClient/TezosProtocolIndexerClient.js.map +1 -0
- package/protocols/tezos/kt/TezosKtProtocol.js +3 -33
- package/protocols/tezos/kt/TezosKtProtocol.js.map +1 -1
- package/protocols/tezos/sapling/TezosSaplingProtocolOptions.js +5 -1
- package/protocols/tezos/sapling/TezosSaplingProtocolOptions.js.map +1 -1
- package/protocols/tezos/types/TezosTransactionCursor.d.ts +1 -1
- package/protocols/tezos/types/contract/BigMap.d.ts +7 -0
- package/protocols/tezos/types/contract/{BigMapResult.js → BigMap.js} +1 -1
- package/protocols/tezos/types/contract/BigMap.js.map +1 -0
- package/protocols/tezos/types/contract/BigMapEnrtyFilter.d.ts +5 -0
- package/protocols/tezos/types/contract/{ConseilPredicate.js → BigMapEnrtyFilter.js} +1 -1
- package/protocols/tezos/types/contract/BigMapEnrtyFilter.js.map +1 -0
- package/protocols/tezos/types/contract/BigMapEntry.d.ts +7 -0
- package/protocols/tezos/types/contract/{BigMapPredicate.js → BigMapEntry.js} +1 -1
- package/protocols/tezos/types/contract/BigMapEntry.js.map +1 -0
- package/protocols/tezos/types/contract/BigMapRequest.d.ts +5 -4
- package/protocols/tezos/types/micheline/MichelineNodeUtils.js +1 -1
- package/protocols/tezos/types/micheline/MichelineNodeUtils.js.map +1 -1
- package/protocols/tezos/types/michelson/MichelsonTypeMeta.js +2 -2
- package/protocols/tezos/types/michelson/MichelsonTypeMeta.js.map +1 -1
- package/protocols/tezos/types/michelson/generics/MichelsonMap.js +1 -1
- package/protocols/tezos/types/michelson/generics/MichelsonMap.js.map +1 -1
- package/protocols/tezos/types/michelson/generics/MichelsonOption.js +1 -1
- package/protocols/tezos/types/michelson/generics/MichelsonOption.js.map +1 -1
- package/protocols/tezos/types/michelson/generics/MichelsonOr.js +2 -2
- package/protocols/tezos/types/michelson/generics/MichelsonOr.js.map +1 -1
- package/protocols/tezos/types/michelson/generics/MichelsonPair.js +2 -2
- package/protocols/tezos/types/michelson/generics/MichelsonPair.js.map +1 -1
- package/protocols/tezos/types/michelson/primitives/MichelsonBool.js +1 -1
- package/protocols/tezos/types/michelson/primitives/MichelsonBool.js.map +1 -1
- package/protocols/tezos/types/michelson/primitives/MichelsonUnit.js +1 -1
- package/protocols/tezos/types/michelson/primitives/MichelsonUnit.js.map +1 -1
- package/protocols/tezos/types/utils.d.ts +4 -1
- package/protocols/tezos/types/utils.js +7 -3
- package/protocols/tezos/types/utils.js.map +1 -1
- package/protocols/tezos/rewardcalculation/TezosRewardCalculation005.d.ts +0 -14
- package/protocols/tezos/rewardcalculation/TezosRewardCalculation005.js +0 -164
- package/protocols/tezos/rewardcalculation/TezosRewardCalculation005.js.map +0 -1
- package/protocols/tezos/rewardcalculation/TezosRewardCalculation006.d.ts +0 -9
- package/protocols/tezos/rewardcalculation/TezosRewardCalculation006.js +0 -51
- package/protocols/tezos/rewardcalculation/TezosRewardCalculation006.js.map +0 -1
- package/protocols/tezos/rewardcalculation/TezosRewardCalculationDefault.d.ts +0 -36
- package/protocols/tezos/rewardcalculation/TezosRewardCalculationDefault.js +0 -642
- package/protocols/tezos/rewardcalculation/TezosRewardCalculationDefault.js.map +0 -1
- package/protocols/tezos/types/contract/BigMapPredicate.d.ts +0 -4
- package/protocols/tezos/types/contract/BigMapPredicate.js.map +0 -1
- package/protocols/tezos/types/contract/BigMapResult.d.ts +0 -6
- package/protocols/tezos/types/contract/BigMapResult.js.map +0 -1
- package/protocols/tezos/types/contract/ConseilPredicate.d.ts +0 -7
- package/protocols/tezos/types/contract/ConseilPredicate.js.map +0 -1
- package/utils/createProtocol.d.ts +0 -3
- package/utils/createProtocol.js +0 -140
- package/utils/createProtocol.js.map +0 -1
|
@@ -51,7 +51,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
51
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
52
|
exports.TezosKolibriUSD = void 0;
|
|
53
53
|
var TezosProtocolOptions_1 = require("../TezosProtocolOptions");
|
|
54
|
-
var TezosUtils_1 = require("../TezosUtils");
|
|
55
54
|
var TezosFA1p2Protocol_1 = require("./TezosFA1p2Protocol");
|
|
56
55
|
var TezosFAProtocolOptions_1 = require("./TezosFAProtocolOptions");
|
|
57
56
|
var TezosKolibriUSD = /** @class */ (function (_super) {
|
|
@@ -64,49 +63,11 @@ var TezosKolibriUSD = /** @class */ (function (_super) {
|
|
|
64
63
|
}
|
|
65
64
|
TezosKolibriUSD.prototype.fetchTokenHolders = function () {
|
|
66
65
|
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
-
var request, values;
|
|
68
66
|
return __generator(this, function (_a) {
|
|
69
|
-
|
|
70
|
-
case 0:
|
|
71
|
-
request = {
|
|
72
|
-
bigMapID: 380
|
|
73
|
-
};
|
|
74
|
-
return [4 /*yield*/, this.contract.conseilBigMapValues(request)];
|
|
75
|
-
case 1:
|
|
76
|
-
values = _a.sent();
|
|
77
|
-
return [2 /*return*/, values
|
|
78
|
-
.map(function (value) {
|
|
79
|
-
try {
|
|
80
|
-
var address = TezosUtils_1.TezosUtils.parseAddress(value.key);
|
|
81
|
-
if (address === undefined || !value.value) {
|
|
82
|
-
return {
|
|
83
|
-
address: '',
|
|
84
|
-
amount: '0'
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
var amount = '0';
|
|
88
|
-
var match = TezosKolibriUSD.extractValueRegex.exec(value.value);
|
|
89
|
-
if (match) {
|
|
90
|
-
amount = match[1];
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
address: address,
|
|
94
|
-
amount: amount
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
catch (_a) {
|
|
98
|
-
return {
|
|
99
|
-
address: '',
|
|
100
|
-
amount: '0'
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
})
|
|
104
|
-
.filter(function (value) { return value.amount !== '0'; })];
|
|
105
|
-
}
|
|
67
|
+
return [2 /*return*/, this.contract.network.extras.indexerClient.getTokenBalances({ contractAddress: this.contract.address, id: 0 }, 10000)];
|
|
106
68
|
});
|
|
107
69
|
});
|
|
108
70
|
};
|
|
109
|
-
TezosKolibriUSD.extractValueRegex = /}\s([0-9]+)$/;
|
|
110
71
|
return TezosKolibriUSD;
|
|
111
72
|
}(TezosFA1p2Protocol_1.TezosFA1p2Protocol));
|
|
112
73
|
exports.TezosKolibriUSD = TezosKolibriUSD;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TezosKolibriUSD.js","sourceRoot":"","sources":["../../../../src/protocols/tezos/fa/TezosKolibriUSD.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAA8D;AAC9D,
|
|
1
|
+
{"version":3,"file":"TezosKolibriUSD.js","sourceRoot":"","sources":["../../../../src/protocols/tezos/fa/TezosKolibriUSD.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAA8D;AAC9D,2DAAyD;AACzD,mEAAgG;AAEhG;IAAqC,mCAAkB;IACrD,yBACkB,OAGf;QAHe,wBAAA,EAAA,cAAsC,+CAAsB,CAC1E,IAAI,2CAAoB,EAAE,EAC1B,IAAI,sDAA6B,EAAE,CACpC;QAJH,YAME,kBAAM,OAAO,CAAC,SACf;QANiB,aAAO,GAAP,OAAO,CAGtB;;IAGH,CAAC;IAEY,2CAAiB,GAA9B;;;gBACE,sBAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,EAAA;;;KAC7H;IACH,sBAAC;AAAD,CAAC,AAbD,CAAqC,uCAAkB,GAatD;AAbY,0CAAe"}
|
|
@@ -51,7 +51,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
51
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
52
|
exports.TezosStaker = void 0;
|
|
53
53
|
var TezosProtocolOptions_1 = require("../TezosProtocolOptions");
|
|
54
|
-
var TezosUtils_1 = require("../TezosUtils");
|
|
55
54
|
var TezosFA1Protocol_1 = require("./TezosFA1Protocol");
|
|
56
55
|
var TezosFAProtocolOptions_1 = require("./TezosFAProtocolOptions");
|
|
57
56
|
var TezosStaker = /** @class */ (function (_super) {
|
|
@@ -64,21 +63,8 @@ var TezosStaker = /** @class */ (function (_super) {
|
|
|
64
63
|
}
|
|
65
64
|
TezosStaker.prototype.fetchTokenHolders = function () {
|
|
66
65
|
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
-
var values;
|
|
68
66
|
return __generator(this, function (_a) {
|
|
69
|
-
|
|
70
|
-
case 0: return [4 /*yield*/, this.contract.conseilBigMapValues()];
|
|
71
|
-
case 1:
|
|
72
|
-
values = _a.sent();
|
|
73
|
-
return [2 /*return*/, values
|
|
74
|
-
.map(function (value) {
|
|
75
|
-
return {
|
|
76
|
-
address: TezosUtils_1.TezosUtils.parseAddress(value.key.substring(2)),
|
|
77
|
-
amount: value.value !== null ? value.value : '0'
|
|
78
|
-
};
|
|
79
|
-
})
|
|
80
|
-
.filter(function (value) { return value.amount !== '0'; })];
|
|
81
|
-
}
|
|
67
|
+
return [2 /*return*/, this.contract.network.extras.indexerClient.getTokenBalances({ contractAddress: this.contract.address, id: 0 }, 10000)];
|
|
82
68
|
});
|
|
83
69
|
});
|
|
84
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TezosStaker.js","sourceRoot":"","sources":["../../../../src/protocols/tezos/fa/TezosStaker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAA8D;AAC9D,
|
|
1
|
+
{"version":3,"file":"TezosStaker.js","sourceRoot":"","sources":["../../../../src/protocols/tezos/fa/TezosStaker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAA8D;AAC9D,uDAAqD;AACrD,mEAA4F;AAE5F;IAAiC,+BAAgB;IAC/C,qBACkB,OAGf;QAHe,wBAAA,EAAA,cAAsC,+CAAsB,CAC1E,IAAI,2CAAoB,EAAE,EAC1B,IAAI,kDAAyB,EAAE,CAChC;QAJH,YAME,kBAAM,OAAO,CAAC,SACf;QANiB,aAAO,GAAP,OAAO,CAGtB;;IAGH,CAAC;IAEY,uCAAiB,GAA9B;;;gBACE,sBAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,EAAA;;;KAC7H;IACH,kBAAC;AAAD,CAAC,AAbD,CAAiC,mCAAgB,GAahD;AAbY,kCAAW"}
|
|
@@ -2,7 +2,6 @@ import { TezosFA1p2Protocol } from './TezosFA1p2Protocol';
|
|
|
2
2
|
import { TezosFAProtocolOptions } from './TezosFAProtocolOptions';
|
|
3
3
|
export declare class TezosUSD extends TezosFA1p2Protocol {
|
|
4
4
|
readonly options: TezosFAProtocolOptions;
|
|
5
|
-
private static readonly extractAmountRegex;
|
|
6
5
|
constructor(options?: TezosFAProtocolOptions);
|
|
7
6
|
fetchTokenHolders(): Promise<{
|
|
8
7
|
address: string;
|
|
@@ -51,7 +51,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
51
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
52
|
exports.TezosUSD = void 0;
|
|
53
53
|
var TezosProtocolOptions_1 = require("../TezosProtocolOptions");
|
|
54
|
-
var TezosUtils_1 = require("../TezosUtils");
|
|
55
54
|
var TezosFA1p2Protocol_1 = require("./TezosFA1p2Protocol");
|
|
56
55
|
var TezosFAProtocolOptions_1 = require("./TezosFAProtocolOptions");
|
|
57
56
|
var TezosUSD = /** @class */ (function (_super) {
|
|
@@ -64,47 +63,11 @@ var TezosUSD = /** @class */ (function (_super) {
|
|
|
64
63
|
}
|
|
65
64
|
TezosUSD.prototype.fetchTokenHolders = function () {
|
|
66
65
|
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
-
var values;
|
|
68
66
|
return __generator(this, function (_a) {
|
|
69
|
-
|
|
70
|
-
case 0: return [4 /*yield*/, this.contract.conseilBigMapValues()];
|
|
71
|
-
case 1:
|
|
72
|
-
values = _a.sent();
|
|
73
|
-
return [2 /*return*/, values
|
|
74
|
-
.map(function (value) {
|
|
75
|
-
try {
|
|
76
|
-
var address = TezosUtils_1.TezosUtils.parseAddress(value.key);
|
|
77
|
-
if (address === undefined || !value.value) {
|
|
78
|
-
return {
|
|
79
|
-
address: '',
|
|
80
|
-
amount: '0'
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
var amount = '0';
|
|
84
|
-
// unfortunately, conseil returns the big map value as a parsed Michelson instead of the Micheline JSON
|
|
85
|
-
// so we need to extract the amount using this regex instead of parsing it as a JSON.
|
|
86
|
-
var match = TezosUSD.extractAmountRegex.exec(value.value);
|
|
87
|
-
if (match) {
|
|
88
|
-
amount = match[1];
|
|
89
|
-
}
|
|
90
|
-
return {
|
|
91
|
-
address: address,
|
|
92
|
-
amount: amount
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
catch (_a) {
|
|
96
|
-
return {
|
|
97
|
-
address: '',
|
|
98
|
-
amount: '0'
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
})
|
|
102
|
-
.filter(function (value) { return value.amount !== '0'; })];
|
|
103
|
-
}
|
|
67
|
+
return [2 /*return*/, this.contract.network.extras.indexerClient.getTokenBalances({ contractAddress: this.contract.address, id: 0 }, 10000)];
|
|
104
68
|
});
|
|
105
69
|
});
|
|
106
70
|
};
|
|
107
|
-
TezosUSD.extractAmountRegex = /Pair ([0-9]+) /;
|
|
108
71
|
return TezosUSD;
|
|
109
72
|
}(TezosFA1p2Protocol_1.TezosFA1p2Protocol));
|
|
110
73
|
exports.TezosUSD = TezosUSD;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TezosUSD.js","sourceRoot":"","sources":["../../../../src/protocols/tezos/fa/TezosUSD.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAA8D;AAC9D,
|
|
1
|
+
{"version":3,"file":"TezosUSD.js","sourceRoot":"","sources":["../../../../src/protocols/tezos/fa/TezosUSD.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAA8D;AAC9D,2DAAyD;AACzD,mEAAyF;AAEzF;IAA8B,4BAAkB;IAC9C,kBACkB,OAAsH;QAAtH,wBAAA,EAAA,cAAsC,+CAAsB,CAAC,IAAI,2CAAoB,EAAE,EAAE,IAAI,+CAAsB,EAAE,CAAC;QADxI,YAGE,kBAAM,OAAO,CAAC,SACf;QAHiB,aAAO,GAAP,OAAO,CAA+G;;IAGxI,CAAC;IAEY,oCAAiB,GAA9B;;;gBACE,sBAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,EAAA;;;KAC7H;IACH,eAAC;AAAD,CAAC,AAVD,CAA8B,uCAAkB,GAU/C;AAVY,4BAAQ"}
|
|
@@ -51,7 +51,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
51
51
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
52
|
exports.TezosWrapped = void 0;
|
|
53
53
|
var TezosProtocolOptions_1 = require("../TezosProtocolOptions");
|
|
54
|
-
var TezosUtils_1 = require("../TezosUtils");
|
|
55
54
|
var TezosFA1p2Protocol_1 = require("./TezosFA1p2Protocol");
|
|
56
55
|
var TezosFAProtocolOptions_1 = require("./TezosFAProtocolOptions");
|
|
57
56
|
var TezosWrapped = /** @class */ (function (_super) {
|
|
@@ -64,42 +63,8 @@ var TezosWrapped = /** @class */ (function (_super) {
|
|
|
64
63
|
}
|
|
65
64
|
TezosWrapped.prototype.fetchTokenHolders = function () {
|
|
66
65
|
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
-
var request, values;
|
|
68
66
|
return __generator(this, function (_a) {
|
|
69
|
-
|
|
70
|
-
case 0:
|
|
71
|
-
request = {
|
|
72
|
-
bigMapID: 257
|
|
73
|
-
};
|
|
74
|
-
return [4 /*yield*/, this.contract.conseilBigMapValues(request)];
|
|
75
|
-
case 1:
|
|
76
|
-
values = _a.sent();
|
|
77
|
-
return [2 /*return*/, values
|
|
78
|
-
.map(function (value) {
|
|
79
|
-
try {
|
|
80
|
-
var address = TezosUtils_1.TezosUtils.parseAddress(value.key);
|
|
81
|
-
if (address === undefined || !value.value) {
|
|
82
|
-
return {
|
|
83
|
-
address: '',
|
|
84
|
-
amount: '0'
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
var amount = '0';
|
|
88
|
-
amount = value.value;
|
|
89
|
-
return {
|
|
90
|
-
address: address,
|
|
91
|
-
amount: amount
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
catch (_a) {
|
|
95
|
-
return {
|
|
96
|
-
address: '',
|
|
97
|
-
amount: '0'
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
.filter(function (value) { return value.amount !== '0'; })];
|
|
102
|
-
}
|
|
67
|
+
return [2 /*return*/, this.contract.network.extras.indexerClient.getTokenBalances({ contractAddress: this.contract.address, id: 0 }, 10000)];
|
|
103
68
|
});
|
|
104
69
|
});
|
|
105
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TezosWrapped.js","sourceRoot":"","sources":["../../../../src/protocols/tezos/fa/TezosWrapped.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAA8D;AAC9D,
|
|
1
|
+
{"version":3,"file":"TezosWrapped.js","sourceRoot":"","sources":["../../../../src/protocols/tezos/fa/TezosWrapped.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAA8D;AAC9D,2DAAyD;AACzD,mEAA6F;AAE7F;IAAkC,gCAAkB;IAClD,sBACkB,OAGf;QAHe,wBAAA,EAAA,cAAsC,+CAAsB,CAC1E,IAAI,2CAAoB,EAAE,EAC1B,IAAI,mDAA0B,EAAE,CACjC;QAJH,YAME,kBAAM,OAAO,CAAC,SACf;QANiB,aAAO,GAAP,OAAO,CAGtB;;IAGH,CAAC;IAEY,wCAAiB,GAA9B;;;gBACE,sBAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,EAAA;;;KAC7H;IACH,mBAAC;AAAD,CAAC,AAbD,CAAkC,uCAAkB,GAanD;AAbY,oCAAY"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IAirGapTransaction } from '../../../interfaces/IAirGapTransaction';
|
|
2
|
+
import { BigMap } from '../types/contract/BigMap';
|
|
3
|
+
import { BigMapEntryFilter } from '../types/contract/BigMapEnrtyFilter';
|
|
4
|
+
import { BigMapEntry } from '../types/contract/BigMapEntry';
|
|
5
|
+
import { TezosProtocolIndexerClient, Token } from './TezosProtocolIndexerClient';
|
|
6
|
+
export declare class TezosIndexerClient implements TezosProtocolIndexerClient {
|
|
7
|
+
readonly baseUrl: string;
|
|
8
|
+
constructor(baseUrl: string);
|
|
9
|
+
getTransactions(address: string, limit?: number, offset?: number): Promise<Omit<IAirGapTransaction, 'protocolIdentifier' | 'network'>[]>;
|
|
10
|
+
getDelegationInfo(address: string): Promise<{
|
|
11
|
+
date: Date;
|
|
12
|
+
level: number;
|
|
13
|
+
} | undefined>;
|
|
14
|
+
getTokenTransactionsForAddress(token: Token, address: string, limit?: number, offset?: number): Promise<Omit<IAirGapTransaction, 'protocolIdentifier' | 'network'>[]>;
|
|
15
|
+
getTokenTransactions(token: Token, limit?: number, offset?: number): Promise<Omit<IAirGapTransaction, 'protocolIdentifier' | 'network'>[]>;
|
|
16
|
+
getTokenBalances(token: Token, limit?: number, offset?: number): Promise<{
|
|
17
|
+
address: string;
|
|
18
|
+
amount: string;
|
|
19
|
+
}[]>;
|
|
20
|
+
getContractBigMaps(contractAddress: string, limit?: number, offset?: number): Promise<BigMap[]>;
|
|
21
|
+
getContractBigMapValues(contractAddress: string, bigMap: Omit<BigMap, 'keyType' | 'valueType'>, filters?: BigMapEntryFilter[], limit?: number, offset?: number): Promise<BigMapEntry[]>;
|
|
22
|
+
getContractBigMapValue(contractAddress: string, bigMap: Omit<BigMap, 'keyType' | 'valueType'>, key: string, limit?: number, offset?: number): Promise<BigMapEntry>;
|
|
23
|
+
getDelegatorContracts(address: string, limit?: number, offset?: number): Promise<string[]>;
|
|
24
|
+
private url;
|
|
25
|
+
}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.TezosIndexerClient = void 0;
|
|
43
|
+
var axios_0_19_0_1 = __importDefault(require("../../../dependencies/src/axios-0.19.0"));
|
|
44
|
+
var bignumber_1 = __importDefault(require("../../../dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
45
|
+
var TezosIndexerClient = /** @class */ (function () {
|
|
46
|
+
function TezosIndexerClient(baseUrl) {
|
|
47
|
+
this.baseUrl = baseUrl;
|
|
48
|
+
}
|
|
49
|
+
TezosIndexerClient.prototype.getTransactions = function (address, limit, offset) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
+
var url, result;
|
|
52
|
+
return __generator(this, function (_a) {
|
|
53
|
+
switch (_a.label) {
|
|
54
|
+
case 0:
|
|
55
|
+
url = this.url("/accounts/" + address + "/operations", 'type=transaction', limit, offset);
|
|
56
|
+
return [4 /*yield*/, axios_0_19_0_1.default.get(url)];
|
|
57
|
+
case 1:
|
|
58
|
+
result = (_a.sent()).data;
|
|
59
|
+
return [2 /*return*/, result.map(function (transaction) { return ({
|
|
60
|
+
amount: new bignumber_1.default(transaction.amount).toFixed(),
|
|
61
|
+
fee: new bignumber_1.default(transaction.bakerFee).toFixed(),
|
|
62
|
+
from: [transaction.sender.address],
|
|
63
|
+
to: [transaction.target.address],
|
|
64
|
+
isInbound: transaction.target.address === address,
|
|
65
|
+
hash: transaction.hash,
|
|
66
|
+
timestamp: new Date(transaction.timestamp).getTime(),
|
|
67
|
+
blockHeight: transaction.level,
|
|
68
|
+
status: transaction.status
|
|
69
|
+
}); })];
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
TezosIndexerClient.prototype.getDelegationInfo = function (address) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
+
var url, result;
|
|
77
|
+
return __generator(this, function (_a) {
|
|
78
|
+
switch (_a.label) {
|
|
79
|
+
case 0:
|
|
80
|
+
url = this.url("/accounts/" + address);
|
|
81
|
+
return [4 /*yield*/, axios_0_19_0_1.default.get(url)];
|
|
82
|
+
case 1:
|
|
83
|
+
result = (_a.sent()).data;
|
|
84
|
+
return [2 /*return*/, result.delegate !== undefined && result.delegate.active
|
|
85
|
+
? {
|
|
86
|
+
date: new Date(result.delegationTime),
|
|
87
|
+
level: result.delegationLevel
|
|
88
|
+
}
|
|
89
|
+
: undefined];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
TezosIndexerClient.prototype.getTokenTransactionsForAddress = function (token, address, limit, offset) {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
+
var url, result;
|
|
97
|
+
return __generator(this, function (_a) {
|
|
98
|
+
switch (_a.label) {
|
|
99
|
+
case 0:
|
|
100
|
+
url = this.url("/tokens/transfers", "anyof.from.to.eq=" + address + "?token.contract=" + token.contractAddress + "?token.tokenId=" + token.id, limit, offset);
|
|
101
|
+
return [4 /*yield*/, axios_0_19_0_1.default.get(url)];
|
|
102
|
+
case 1:
|
|
103
|
+
result = (_a.sent()).data;
|
|
104
|
+
return [2 /*return*/, result.map(function (transaction) { return ({
|
|
105
|
+
amount: transaction.amount,
|
|
106
|
+
fee: '0',
|
|
107
|
+
from: transaction.from.address,
|
|
108
|
+
to: transaction.to.address,
|
|
109
|
+
isInbound: transaction.to.address === address,
|
|
110
|
+
timestamp: new Date(transaction.timestamp).getTime(),
|
|
111
|
+
blockHeight: transaction.level
|
|
112
|
+
}); })];
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
TezosIndexerClient.prototype.getTokenTransactions = function (token, limit, offset) {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
119
|
+
var url, result;
|
|
120
|
+
return __generator(this, function (_a) {
|
|
121
|
+
switch (_a.label) {
|
|
122
|
+
case 0:
|
|
123
|
+
url = this.url("/tokens/transfers", "token.contract=" + token.contractAddress + "?token.tokenId=" + token.id, limit, offset);
|
|
124
|
+
return [4 /*yield*/, axios_0_19_0_1.default.get(url)];
|
|
125
|
+
case 1:
|
|
126
|
+
result = (_a.sent()).data;
|
|
127
|
+
return [2 /*return*/, result.map(function (transaction) { return ({
|
|
128
|
+
amount: transaction.amount,
|
|
129
|
+
fee: '0',
|
|
130
|
+
from: transaction.from.address,
|
|
131
|
+
to: transaction.to.address,
|
|
132
|
+
isInbound: false,
|
|
133
|
+
timestamp: new Date(transaction.timestamp).getTime(),
|
|
134
|
+
blockHeight: transaction.level
|
|
135
|
+
}); })];
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
TezosIndexerClient.prototype.getTokenBalances = function (token, limit, offset) {
|
|
141
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
142
|
+
var url, result;
|
|
143
|
+
return __generator(this, function (_a) {
|
|
144
|
+
switch (_a.label) {
|
|
145
|
+
case 0:
|
|
146
|
+
url = this.url("/tokens/balances", "token.contract=" + token.contractAddress + "&token.tokenId=" + token.id + "&balance.gt=0", limit, offset);
|
|
147
|
+
return [4 /*yield*/, axios_0_19_0_1.default.get(url)];
|
|
148
|
+
case 1:
|
|
149
|
+
result = (_a.sent()).data;
|
|
150
|
+
return [2 /*return*/, result.map(function (item) { return ({
|
|
151
|
+
address: item.account.address,
|
|
152
|
+
amount: item.balance
|
|
153
|
+
}); })];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
TezosIndexerClient.prototype.getContractBigMaps = function (contractAddress, limit, offset) {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
160
|
+
var url, result;
|
|
161
|
+
return __generator(this, function (_a) {
|
|
162
|
+
switch (_a.label) {
|
|
163
|
+
case 0:
|
|
164
|
+
url = this.url("/contracts/" + contractAddress + "/bigmaps", 'micheline=2', limit, offset);
|
|
165
|
+
return [4 /*yield*/, axios_0_19_0_1.default.get(url)];
|
|
166
|
+
case 1:
|
|
167
|
+
result = (_a.sent()).data;
|
|
168
|
+
return [2 /*return*/, result.map(function (bigMap) { return ({
|
|
169
|
+
id: bigMap.ptr,
|
|
170
|
+
path: bigMap.path,
|
|
171
|
+
keyType: bigMap.keyType,
|
|
172
|
+
valueType: bigMap.valueType
|
|
173
|
+
}); })];
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
TezosIndexerClient.prototype.getContractBigMapValues = function (contractAddress, bigMap, filters, limit, offset) {
|
|
179
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
180
|
+
var url, _i, filters_1, filter, result;
|
|
181
|
+
return __generator(this, function (_a) {
|
|
182
|
+
switch (_a.label) {
|
|
183
|
+
case 0:
|
|
184
|
+
url = this.url("/contracts/" + contractAddress + "/bigmaps/" + bigMap.path + "/keys", 'micheline=2', limit, offset);
|
|
185
|
+
if (filters !== undefined) {
|
|
186
|
+
for (_i = 0, filters_1 = filters; _i < filters_1.length; _i++) {
|
|
187
|
+
filter = filters_1[_i];
|
|
188
|
+
url = url + "&" + filter.field + "." + filter.operation + "=" + filter.value;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return [4 /*yield*/, axios_0_19_0_1.default.get(url)];
|
|
192
|
+
case 1:
|
|
193
|
+
result = (_a.sent()).data;
|
|
194
|
+
return [2 /*return*/, result.map(function (entry) { return ({
|
|
195
|
+
bigMapId: bigMap.id,
|
|
196
|
+
key: entry.key,
|
|
197
|
+
keyHash: entry.hash,
|
|
198
|
+
value: entry.value
|
|
199
|
+
}); })];
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
TezosIndexerClient.prototype.getContractBigMapValue = function (contractAddress, bigMap, key, limit, offset) {
|
|
205
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
206
|
+
var url, entry;
|
|
207
|
+
return __generator(this, function (_a) {
|
|
208
|
+
switch (_a.label) {
|
|
209
|
+
case 0:
|
|
210
|
+
url = this.url("/contracts/" + contractAddress + "/bigmaps/" + bigMap.path + "/keys/" + key, 'micheline=2', limit, offset);
|
|
211
|
+
return [4 /*yield*/, axios_0_19_0_1.default.get(url)];
|
|
212
|
+
case 1:
|
|
213
|
+
entry = (_a.sent()).data;
|
|
214
|
+
return [2 /*return*/, {
|
|
215
|
+
bigMapId: bigMap.id,
|
|
216
|
+
key: entry.key,
|
|
217
|
+
keyHash: entry.hash,
|
|
218
|
+
value: entry.value
|
|
219
|
+
}];
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
TezosIndexerClient.prototype.getDelegatorContracts = function (address, limit, offset) {
|
|
225
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
226
|
+
var url, result;
|
|
227
|
+
return __generator(this, function (_a) {
|
|
228
|
+
switch (_a.label) {
|
|
229
|
+
case 0:
|
|
230
|
+
url = this.url('/operations/originations', "contractManager=" + address + "&status=applied&select=originatedContract");
|
|
231
|
+
return [4 /*yield*/, axios_0_19_0_1.default.get(url)];
|
|
232
|
+
case 1:
|
|
233
|
+
result = (_a.sent()).data;
|
|
234
|
+
return [2 /*return*/, result.filter(function (contract) { return contract.kind === 'delegator_contract'; }).map(function (contract) { return contract.address; })];
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
TezosIndexerClient.prototype.url = function (path, query, limit, offset) {
|
|
240
|
+
return this.baseUrl + "/v1" + path + (query ? "?" + query : '') + (limit ? (query ? '&' : '?') + "limit=" + limit : '') + (offset ? (query || limit ? '&' : '?') + "offset=" + offset : '');
|
|
241
|
+
};
|
|
242
|
+
return TezosIndexerClient;
|
|
243
|
+
}());
|
|
244
|
+
exports.TezosIndexerClient = TezosIndexerClient;
|
|
245
|
+
//# sourceMappingURL=TezosIndexerClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TezosIndexerClient.js","sourceRoot":"","sources":["../../../../src/protocols/tezos/indexerClient/TezosIndexerClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wFAA0D;AAC1D,qGAA8E;AAO9E;IACE,4BAA4B,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAAG,CAAC;IAElC,4CAAe,GAA5B,UACE,OAAe,EACf,KAAc,EACd,MAAe;;;;;;wBAET,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,eAAa,OAAO,gBAAa,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,CAA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,EAAE,CAC7D,CAAA;IACJ,CAAC;IACH,yBAAC;AAAD,CAAC,AAvJD,IAuJC;AAvJY,gDAAkB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IAirGapTransaction } from '../../../interfaces/IAirGapTransaction';
|
|
2
|
+
import { BigMap } from '../types/contract/BigMap';
|
|
3
|
+
import { BigMapEntryFilter } from '../types/contract/BigMapEnrtyFilter';
|
|
4
|
+
import { BigMapEntry } from '../types/contract/BigMapEntry';
|
|
5
|
+
export interface Token {
|
|
6
|
+
contractAddress: string;
|
|
7
|
+
id: number;
|
|
8
|
+
}
|
|
9
|
+
export interface TezosProtocolIndexerClient {
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
getTransactions(address: string, limit?: number, offset?: number): Promise<Omit<IAirGapTransaction, 'protocolIdentifier' | 'network'>[]>;
|
|
12
|
+
getDelegationInfo(address: string): Promise<{
|
|
13
|
+
date: Date;
|
|
14
|
+
level: number;
|
|
15
|
+
} | undefined>;
|
|
16
|
+
getTokenTransactionsForAddress(token: Token, address: string, limit?: number, offset?: number): Promise<Omit<IAirGapTransaction, 'protocolIdentifier' | 'network'>[]>;
|
|
17
|
+
getTokenTransactions(token: Token, limit?: number, offset?: number): Promise<Omit<IAirGapTransaction, 'protocolIdentifier' | 'network'>[]>;
|
|
18
|
+
getTokenBalances(token: Token, limit?: number, offset?: number): Promise<{
|
|
19
|
+
address: string;
|
|
20
|
+
amount: string;
|
|
21
|
+
}[]>;
|
|
22
|
+
getContractBigMaps(contractAddress: string, limit?: number, offset?: number): Promise<BigMap[]>;
|
|
23
|
+
getContractBigMapValues(contractAddress: string, bigMap: Omit<BigMap, 'keyType' | 'valueType'>, filters?: BigMapEntryFilter[], limit?: number, offset?: number): Promise<BigMapEntry[]>;
|
|
24
|
+
getContractBigMapValue(contractAddress: string, bigMap: Omit<BigMap, 'keyType' | 'valueType'>, key: string, limit?: number, offset?: number): Promise<BigMapEntry>;
|
|
25
|
+
getDelegatorContracts(address: string, limit?: number, offset?: number): Promise<string[]>;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TezosProtocolIndexerClient.js","sourceRoot":"","sources":["../../../../src/protocols/tezos/indexerClient/TezosProtocolIndexerClient.ts"],"names":[],"mappings":""}
|
|
@@ -93,45 +93,15 @@ var TezosKtProtocol = /** @class */ (function (_super) {
|
|
|
93
93
|
};
|
|
94
94
|
TezosKtProtocol.prototype.getAddressesFromPublicKey = function (publicKey) {
|
|
95
95
|
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
-
var tz1address,
|
|
96
|
+
var tz1address, ktAddresses;
|
|
97
97
|
return __generator(this, function (_a) {
|
|
98
98
|
switch (_a.label) {
|
|
99
99
|
case 0: return [4 /*yield*/, _super.prototype.getAddressFromPublicKey.call(this, publicKey)];
|
|
100
100
|
case 1:
|
|
101
101
|
tz1address = (_a.sent()).getValue();
|
|
102
|
-
|
|
103
|
-
return {
|
|
104
|
-
fields: ['originated_contracts'],
|
|
105
|
-
predicates: [
|
|
106
|
-
{
|
|
107
|
-
field: field,
|
|
108
|
-
operation: 'eq',
|
|
109
|
-
set: [tz1address],
|
|
110
|
-
inverse: false
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
field: 'kind',
|
|
114
|
-
operation: 'eq',
|
|
115
|
-
set: [set],
|
|
116
|
-
inverse: false
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
field: 'status',
|
|
120
|
-
operation: 'eq',
|
|
121
|
-
set: ['applied'],
|
|
122
|
-
inverse: false
|
|
123
|
-
}
|
|
124
|
-
]
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
return [4 /*yield*/, index_1.default.post(this.baseApiUrl + "/v2/data/tezos/mainnet/operations", getRequestBody('manager_pubkey', 'origination'), {
|
|
128
|
-
headers: this.headers
|
|
129
|
-
})];
|
|
102
|
+
return [4 /*yield*/, this.options.network.extras.indexerClient.getDelegatorContracts(tz1address, 10000)];
|
|
130
103
|
case 2:
|
|
131
|
-
|
|
132
|
-
ktAddresses = data.map(function (origination) {
|
|
133
|
-
return origination.originated_contracts;
|
|
134
|
-
});
|
|
104
|
+
ktAddresses = _a.sent();
|
|
135
105
|
return [2 /*return*/, Promise.all(ktAddresses.reverse().map(function (ktAddress) { return TezosKtAddress_1.TezosKtAddress.from(ktAddress); }))];
|
|
136
106
|
}
|
|
137
107
|
});
|