@pioneer-platform/osmosis-network 8.1.33 → 8.1.34
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/lib/index.js +51 -44
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -179,7 +179,7 @@ var get_voucher_info = function (voucher) {
|
|
|
179
179
|
case 1:
|
|
180
180
|
_a.trys.push([1, 3, , 4]);
|
|
181
181
|
url = URL_OSMO_LCD + '/ibc/applications/transfer/v1beta1/denom_traces/' + voucher;
|
|
182
|
-
log.
|
|
182
|
+
log.debug(tag, "url: ", url);
|
|
183
183
|
return [4 /*yield*/, axios({ method: 'GET', url: url })];
|
|
184
184
|
case 2:
|
|
185
185
|
txInfo = _a.sent();
|
|
@@ -475,7 +475,7 @@ var get_transaction = function (txid) {
|
|
|
475
475
|
};
|
|
476
476
|
var broadcast_transaction = function (tx) {
|
|
477
477
|
return __awaiter(this, void 0, void 0, function () {
|
|
478
|
-
var tag, output,
|
|
478
|
+
var tag, output, payload, urlRemote, result2, logSend, e_12, e_13;
|
|
479
479
|
return __generator(this, function (_a) {
|
|
480
480
|
switch (_a.label) {
|
|
481
481
|
case 0:
|
|
@@ -489,13 +489,16 @@ var broadcast_transaction = function (tx) {
|
|
|
489
489
|
_a.label = 2;
|
|
490
490
|
case 2:
|
|
491
491
|
_a.trys.push([2, 4, , 5]);
|
|
492
|
-
|
|
493
|
-
|
|
492
|
+
payload = {
|
|
493
|
+
"tx_bytes": tx,
|
|
494
|
+
"mode": "BROADCAST_MODE_SYNC"
|
|
495
|
+
};
|
|
496
|
+
urlRemote = URL_OSMO_LCD + '/cosmos/tx/v1beta1/txs';
|
|
494
497
|
log.debug(tag, "urlRemote: ", urlRemote);
|
|
495
498
|
return [4 /*yield*/, axios({
|
|
496
499
|
url: urlRemote,
|
|
497
500
|
method: 'POST',
|
|
498
|
-
data:
|
|
501
|
+
data: payload,
|
|
499
502
|
})];
|
|
500
503
|
case 3:
|
|
501
504
|
result2 = _a.sent();
|
|
@@ -651,7 +654,9 @@ var get_txs_at_height = function (height) {
|
|
|
651
654
|
case 1:
|
|
652
655
|
_a.trys.push([1, 3, , 4]);
|
|
653
656
|
output = [];
|
|
654
|
-
url = URL_OSMO_LCD + '/txs?tx.height
|
|
657
|
+
url = URL_OSMO_LCD + '/cosmos/tx/v1beta1/txs?events=tx.height=%27' + height + '%27';
|
|
658
|
+
// let url = URL_OSMO_LCD+ '/txs?block.height='+height
|
|
659
|
+
// let url = URL_OSMO_LCD+ '/txs?tx.height='+height
|
|
655
660
|
//tx.height=
|
|
656
661
|
//?tx.height=1891147&page=1
|
|
657
662
|
log.debug(tag, "url: ", url);
|
|
@@ -675,16 +680,17 @@ var get_txs_at_height = function (height) {
|
|
|
675
680
|
};
|
|
676
681
|
var get_txs_by_address = function (address) {
|
|
677
682
|
return __awaiter(this, void 0, void 0, function () {
|
|
678
|
-
var tag, output, url, resultSends, sends, i, tx,
|
|
683
|
+
var tag, output, url, resultSends, sends, i, tx, e_16;
|
|
679
684
|
return __generator(this, function (_a) {
|
|
680
685
|
switch (_a.label) {
|
|
681
686
|
case 0:
|
|
682
687
|
tag = TAG + " | get_txs_by_address | ";
|
|
683
688
|
_a.label = 1;
|
|
684
689
|
case 1:
|
|
685
|
-
_a.trys.push([1,
|
|
690
|
+
_a.trys.push([1, 3, , 4]);
|
|
686
691
|
output = [];
|
|
687
|
-
url = URL_OSMO_LCD + '/txs?
|
|
692
|
+
url = URL_OSMO_LCD + '/cosmos/tx/v1beta1/txs?events=transfer.sender=%27' + address + '%27';
|
|
693
|
+
//let url = URL_OSMO_LCD+ '/txs?message.sender='+address
|
|
688
694
|
log.debug(tag, "url: ", url);
|
|
689
695
|
return [4 /*yield*/, axios({
|
|
690
696
|
url: url,
|
|
@@ -702,29 +708,30 @@ var get_txs_by_address = function (address) {
|
|
|
702
708
|
}
|
|
703
709
|
}
|
|
704
710
|
//receives
|
|
705
|
-
url = URL_OSMO_LCD
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
//
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
}
|
|
711
|
+
//url = URL_OSMO_LCD+ '/txs?transfer.recipient='+address
|
|
712
|
+
//
|
|
713
|
+
// url = URL_OSMO_LCD+ '/cosmos/tx/v1beta1/txs?events=transfer.recipient=%27'+address+'%27'
|
|
714
|
+
// //console.log("URL_OSMO_LCD: ",url)
|
|
715
|
+
// let resultRecieves = await axios({
|
|
716
|
+
// url: url,
|
|
717
|
+
// method: 'GET'
|
|
718
|
+
// })
|
|
719
|
+
// let receives = resultRecieves.data
|
|
720
|
+
// //log.debug('receives: ', JSON.stringify(receives.tx_responses))
|
|
721
|
+
// if(receives.tx_responses){
|
|
722
|
+
// for(let i = 0; i < receives.txs.length; i++ ){
|
|
723
|
+
// let tx = receives.txs[i]
|
|
724
|
+
// //normalize
|
|
725
|
+
// // tx = normalize_tx(tx,address)
|
|
726
|
+
// output.push(tx)
|
|
727
|
+
// }
|
|
728
|
+
// }
|
|
722
729
|
return [2 /*return*/, output];
|
|
723
|
-
case
|
|
730
|
+
case 3:
|
|
724
731
|
e_16 = _a.sent();
|
|
725
732
|
log.error(tag, "e: ", e_16);
|
|
726
733
|
throw e_16;
|
|
727
|
-
case
|
|
734
|
+
case 4: return [2 /*return*/];
|
|
728
735
|
}
|
|
729
736
|
});
|
|
730
737
|
});
|
|
@@ -747,7 +754,7 @@ var get_balances = function (address) {
|
|
|
747
754
|
return [4 /*yield*/, axios({ method: 'GET', url: URL_OSMO_LCD + '/bank/balances/' + address })];
|
|
748
755
|
case 3:
|
|
749
756
|
accountInfo = _b.sent();
|
|
750
|
-
log.
|
|
757
|
+
log.debug(tag, "accountInfo: ", accountInfo.data);
|
|
751
758
|
if (!((_a = accountInfo.data) === null || _a === void 0 ? void 0 : _a.result)) return [3 /*break*/, 9];
|
|
752
759
|
i = 0;
|
|
753
760
|
_b.label = 4;
|
|
@@ -765,11 +772,11 @@ var get_balances = function (address) {
|
|
|
765
772
|
}
|
|
766
773
|
if (!(entry.denom.indexOf('ibc/') >= 0)) return [3 /*break*/, 6];
|
|
767
774
|
voucher = entry.denom.replace('ibc/', '');
|
|
768
|
-
log.
|
|
775
|
+
log.debug(tag, "voucher: ", voucher);
|
|
769
776
|
return [4 /*yield*/, get_voucher_info(voucher)];
|
|
770
777
|
case 5:
|
|
771
778
|
voucherInfo = _b.sent();
|
|
772
|
-
log.
|
|
779
|
+
log.debug(tag, "voucherInfo: ", voucherInfo);
|
|
773
780
|
if (voucherInfo.denom_trace.base_denom === 'uatom') {
|
|
774
781
|
balance = {
|
|
775
782
|
type: 'ibcChannel',
|
|
@@ -778,7 +785,7 @@ var get_balances = function (address) {
|
|
|
778
785
|
asset: 'ATOM',
|
|
779
786
|
denom: voucherInfo.denom_trace.base_denom,
|
|
780
787
|
channel: voucherInfo.denom_trace.path,
|
|
781
|
-
balance: entry.amount
|
|
788
|
+
balance: entry.amount / 1000000
|
|
782
789
|
};
|
|
783
790
|
output.push(balance);
|
|
784
791
|
}
|
|
@@ -793,27 +800,27 @@ var get_balances = function (address) {
|
|
|
793
800
|
case 7:
|
|
794
801
|
poolInfo = _b.sent();
|
|
795
802
|
poolInfo = poolInfo.pools[0];
|
|
796
|
-
log.
|
|
803
|
+
log.debug(tag, "poolInfo: ", poolInfo);
|
|
797
804
|
totalShares = poolInfo.totalShares.amount / 1000000000000000000;
|
|
798
|
-
log.
|
|
805
|
+
log.debug(tag, "totalShares: ", totalShares);
|
|
799
806
|
poolAssets = poolInfo.poolAssets;
|
|
800
|
-
log.
|
|
807
|
+
log.debug(tag, "poolAssets: ", poolAssets);
|
|
801
808
|
assetAtom = poolAssets[0];
|
|
802
|
-
log.
|
|
809
|
+
log.debug(tag, "assetAtom: ", assetAtom);
|
|
803
810
|
assetOsmo = poolAssets[1];
|
|
804
|
-
log.
|
|
811
|
+
log.debug(tag, "assetOsmo: ", assetOsmo);
|
|
805
812
|
totalAtom = assetAtom.token.amount / 10000000;
|
|
806
|
-
log.
|
|
813
|
+
log.debug(tag, "totalAtom: ", totalAtom);
|
|
807
814
|
totalOsmo = assetOsmo.token.amount / 1000000;
|
|
808
|
-
log.
|
|
815
|
+
log.debug(tag, "totalOsmo: ", totalOsmo);
|
|
809
816
|
yourLpTokens = entry.amount / 1000000000000000000;
|
|
810
|
-
log.
|
|
817
|
+
log.debug(tag, "yourLpTokens: ", yourLpTokens);
|
|
811
818
|
yourLpPercent = yourLpTokens / totalShares;
|
|
812
|
-
log.
|
|
819
|
+
log.debug(tag, "yourLpPercent: ", yourLpPercent);
|
|
813
820
|
yourAtomInPool = totalAtom * yourLpPercent;
|
|
814
|
-
log.
|
|
821
|
+
log.debug(tag, "yourAtomInPool: ", yourAtomInPool);
|
|
815
822
|
yourOsmoInPool = totalOsmo * yourLpPercent;
|
|
816
|
-
log.
|
|
823
|
+
log.debug(tag, "yourOsmoInPool: ", yourOsmoInPool);
|
|
817
824
|
balance = {
|
|
818
825
|
type: 'lptoken',
|
|
819
826
|
lp: true,
|
|
@@ -862,7 +869,7 @@ var get_balance = function (address) {
|
|
|
862
869
|
return [4 /*yield*/, axios({ method: 'GET', url: URL_OSMO_LCD + '/bank/balances/' + address })];
|
|
863
870
|
case 3:
|
|
864
871
|
accountInfo = _b.sent();
|
|
865
|
-
log.
|
|
872
|
+
log.debug(tag, "accountInfo: ", accountInfo.data);
|
|
866
873
|
//
|
|
867
874
|
if ((_a = accountInfo.data) === null || _a === void 0 ? void 0 : _a.result) {
|
|
868
875
|
for (i = 0; i < accountInfo.data.result.length; i++) {
|