stackswap-front-api-test-02 1.2.5 → 1.2.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/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +13 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/stackswap/manager/poxl.manager.js +1 -1
- package/dist/esm/stackswap/manager/staking.manager.js +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/stackswap/manager/poxl.manager.js +1 -1
- package/dist/stackswap/manager/staking.manager.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +15 -4
- package/src/stackswap/manager/poxl.manager.ts +1 -1
- package/src/stackswap/manager/staking.manager.ts +1 -1
|
@@ -43,7 +43,7 @@ class PoxlManager {
|
|
|
43
43
|
await (0, transactions_1.callReadOnlyFunction)((0, util_1.getReadOptions)(this.stackswap, contract_address, 'get-random-uint-at-block', [(0, transactions_1.uintCV)(input)]));
|
|
44
44
|
}
|
|
45
45
|
async getMinedBlock(contract_address, offset) {
|
|
46
|
-
const get_result = await axios_1.default.get(this.stackswap.config.STACKS_API_URL() + '/extended/
|
|
46
|
+
const get_result = await axios_1.default.get(this.stackswap.config.STACKS_API_URL() + '/extended/v2/address/' + this.stackswap.getSenderAddress() + '/transactions', {
|
|
47
47
|
params: {
|
|
48
48
|
limit: 40,
|
|
49
49
|
offset,
|
|
@@ -110,7 +110,7 @@ class StakingManager {
|
|
|
110
110
|
}
|
|
111
111
|
async getRewardRoundID(offset) {
|
|
112
112
|
const ADDR = this.stackswap.config.STACKSWAP_ADDRESS() + '.' + this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_LOGIC_V2();
|
|
113
|
-
const get_result = await axios_1.default.get(this.stackswap.config.STACKS_API_URL() + '/extended/
|
|
113
|
+
const get_result = await axios_1.default.get(this.stackswap.config.STACKS_API_URL() + '/extended/v2/address/' + this.stackswap.getSenderAddress() + '/transactions', {
|
|
114
114
|
params: {
|
|
115
115
|
limit: 50,
|
|
116
116
|
offset,
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ import {LBTCStakingManager} from "./stackswap/manager/lbtcstaking.manager";
|
|
|
25
25
|
import {GroupFarmManager} from "./stackswap/manager/groupfarm.manager";
|
|
26
26
|
import {BridgeManager} from "./stackswap/manager/bridge.manager";
|
|
27
27
|
import {Farm3Manager} from "./stackswap/manager/farm3.manager";
|
|
28
|
+
import {hexToCV} from "@stacks/transactions";
|
|
28
29
|
|
|
29
30
|
export interface StackswapAPI {
|
|
30
31
|
config : StackswapConfig;
|
|
@@ -115,18 +116,28 @@ export class StackswapMainnetAPI implements StackswapAPI{
|
|
|
115
116
|
getSenderAddress() : string {
|
|
116
117
|
return this.fixedSenderAddress? this.fixedSenderAddress : this.senderAdderss;
|
|
117
118
|
}
|
|
119
|
+
getTenureBlockHeight: ()=> Promise<any> = async () => {
|
|
120
|
+
const get_result = await axios.post(`${this.config.STACKS_API_URL()}/v2/contracts/call-read/SP3RF75T6HCZF0DG7ZATSHRBJ3Q17CBYMN1AEBR1Q/tenure-block/get-block-numbers`, {sender:"SP3RF75T6HCZF0DG7ZATSHRBJ3Q17CBYMN1AEBR1Q",arguments:[]}
|
|
121
|
+
);
|
|
122
|
+
return Number((hexToCV(get_result.data.result) as any).value);
|
|
123
|
+
}
|
|
118
124
|
|
|
125
|
+
getFastBlockHeight: ()=> Promise<any> = async () => {
|
|
126
|
+
const get_result = await axios.get(`${this.config.STACKS_API_URL()}/v2/info`);
|
|
127
|
+
//TODO should change
|
|
128
|
+
return get_result.data.stacks_tip_height;
|
|
129
|
+
}
|
|
119
130
|
|
|
120
131
|
getCurrentBlock: () => Promise<any> = async () => {
|
|
121
132
|
//https://stacks-node-api.mainnet.stacks.co/extended/v1/block?limit=0
|
|
122
|
-
const get_result = await axios.get(this.config.STACKS_API_URL() + '/
|
|
123
|
-
return get_result.data.
|
|
133
|
+
const get_result = await axios.get(this.config.STACKS_API_URL() + '/v2/info');
|
|
134
|
+
return get_result.data.stacks_tip_height;
|
|
124
135
|
};
|
|
125
136
|
|
|
126
137
|
// @ts-ignore
|
|
127
138
|
async getCurrentBlocks() {
|
|
128
|
-
const get_result = await axios.get(this.config.STACKS_API_URL() + '/
|
|
129
|
-
return {block_height : get_result.data.
|
|
139
|
+
const get_result = await axios.get(this.config.STACKS_API_URL() + '/v2/info');
|
|
140
|
+
return {block_height : get_result.data.stacks_tip_height, burn_block_height : get_result.data.burn_block_height, tenure_block_height : await this.getTenureBlockHeight()};
|
|
130
141
|
}
|
|
131
142
|
|
|
132
143
|
getQualifiedAddress(address: string): string {
|
|
@@ -52,7 +52,7 @@ export class PoxlManager {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
async getMinedBlock( contract_address: string, offset: number) {
|
|
55
|
-
const get_result = await axios.get( this.stackswap.config.STACKS_API_URL() + '/extended/
|
|
55
|
+
const get_result = await axios.get( this.stackswap.config.STACKS_API_URL() + '/extended/v2/address/' + this.stackswap.getSenderAddress() + '/transactions', {
|
|
56
56
|
params: {
|
|
57
57
|
limit: 40,
|
|
58
58
|
offset,
|
|
@@ -141,7 +141,7 @@ export class StakingManager {
|
|
|
141
141
|
|
|
142
142
|
async getRewardRoundID(offset: number) {
|
|
143
143
|
const ADDR = this.stackswap.config.STACKSWAP_ADDRESS()+'.'+this.stackswap.config.CONTRACT_NAME_STACKSWAP_STSW_STACKING_LOGIC_V2();
|
|
144
|
-
const get_result = await axios.get(this.stackswap.config.STACKS_API_URL() + '/extended/
|
|
144
|
+
const get_result = await axios.get(this.stackswap.config.STACKS_API_URL() + '/extended/v2/address/' + this.stackswap.getSenderAddress() + '/transactions', {
|
|
145
145
|
params: {
|
|
146
146
|
limit: 50,
|
|
147
147
|
offset,
|