Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge-develop-to-public #389

Merged
merged 182 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
182 commits
Select commit Hold shift + click to select a range
fc1cf77
Fix the send ordinals method and add tests
victorkirov Jun 21, 2024
6ebc4f1
refactor message signing utils based on protocol
m-aboelenein Jul 10, 2024
2f497d7
push
terencehh Jul 10, 2024
11d248a
Merge pull request #128 from secretkeylabs/terence-make-fp-optional
terencehh Jul 10, 2024
52fb679
Merge branch 'develop' of https://github.com/secretkeylabs/xverse-cor…
terencehh Jul 11, 2024
d758903
added ecdsa support for ledger native segwit and update util
m-aboelenein Jul 11, 2024
1d0ca4d
export hashing util for ecdsa
m-aboelenein Jul 11, 2024
ef7fc43
Merge branch 'develop' into mahmoud/eng-4642-sats-connect-signmessage…
m-aboelenein Jul 11, 2024
f158fa8
Add swaps endpoints to xverse client
victorkirov Jul 11, 2024
16afebc
Remove place utxo order identifier field
victorkirov Jul 11, 2024
d50b42a
disable ecdsa for taproot addresses
m-aboelenein Jul 11, 2024
017b020
Added js doc as per review
victorkirov Jul 15, 2024
ffcc734
signMessageECDSA accepts addressType
m-aboelenein Jul 15, 2024
ece8bff
updated return type
m-aboelenein Jul 15, 2024
063be9b
fix import
m-aboelenein Jul 15, 2024
e7933ec
Merge pull request #115 from secretkeylabs/vic/split-send
m-aboelenein Jul 16, 2024
49d52a0
Merge pull request #127 from secretkeylabs/mahmoud/eng-4642-sats-conn…
m-aboelenein Jul 16, 2024
59e84a4
release: v18.0.0
Jul 16, 2024
8e9bf01
Merge pull request #130 from secretkeylabs/release/v18.0.0
m-aboelenein Jul 16, 2024
294fd3f
Merge branch 'develop' into vic/swaps-api
fedeerbes Jul 17, 2024
d0501db
Update rune ticker in jsdoc
victorkirov Jul 17, 2024
2a78f82
Schema changes for unisat
victorkirov Jul 18, 2024
b88d940
Add utxo quote service fee
victorkirov Jul 18, 2024
c687a5a
chore: add feature id for swaps
fedeerbes Jul 18, 2024
04700e5
Merge branch 'vic/swaps-api' of github.com:secretkeylabs/xverse-core-…
fedeerbes Jul 18, 2024
bc72aff
Merge pull request #129 from secretkeylabs/vic/swaps-api
jordankzf Jul 19, 2024
9abf66f
release: v18.1.0
Jul 19, 2024
24535a5
Merge pull request #132 from secretkeylabs/release/v18.1.0
jordankzf Jul 19, 2024
2d39164
Allow identifying signing indexes via nonWitnessUtxo
victorkirov Jul 19, 2024
c21c7ed
Merge pull request #134 from secretkeylabs/vic/nonwitnessutxo
victorkirov Jul 19, 2024
b1c6c45
Use fallback electrs api on 429
victorkirov Jul 19, 2024
761df1a
Merge pull request #135 from secretkeylabs/vic/429
victorkirov Jul 19, 2024
5151a21
chore: add swaps analytic event types (#133)
fedeerbes Jul 19, 2024
75a8f06
release: v18.1.1
Jul 19, 2024
2fe819d
Merge pull request #136 from secretkeylabs/release/v18.1.1
fedeerbes Jul 19, 2024
411ad99
chore: export missing type
teebszet Jul 22, 2024
abe9074
chore: make npm run script names consistent
teebszet Jul 22, 2024
5d998f3
Use set sighash type on internal transaction signs
victorkirov Jul 22, 2024
ec71122
Merge pull request #137 from secretkeylabs/tim/export-missing-type
teebszet Jul 22, 2024
ff49b21
Merge branch 'develop' into vic/sighash
victorkirov Jul 22, 2024
be6cb15
Merge pull request #138 from secretkeylabs/vic/sighash
victorkirov Jul 22, 2024
7f85489
fix: swap interface typo (#139)
fedeerbes Jul 22, 2024
0c99d27
release: v18.2.0
Jul 22, 2024
11a10bf
Merge pull request #140 from secretkeylabs/release/v18.2.0
fedeerbes Jul 22, 2024
144dcf7
Add fromAmount and toAmount to Swap Mixpanel events
jordankzf Jul 25, 2024
8221216
Add function to send many runes to many recipients
victorkirov Jul 25, 2024
3a5ee05
Simplify
jordankzf Jul 25, 2024
c0d840e
Merge pull request #142 from secretkeylabs/eng-4749/mixpanel-from-to-…
jordankzf Jul 25, 2024
f35c26d
release: v18.3.0
Jul 25, 2024
d0af7ab
Merge pull request #144 from secretkeylabs/release/v18.3.0
jordankzf Jul 25, 2024
543fe06
Add parsing runes summary output by recipient
victorkirov Jul 30, 2024
e226703
Add tests for send many runes to many
victorkirov Jul 30, 2024
943f5a4
SelectTokenToSwapFrom and SelectTokenToSwapTo
jordankzf Jul 31, 2024
1af19a4
Add txnHasExternalInputs field to runes summary
victorkirov Jul 31, 2024
056a97f
Merge pull request #146 from secretkeylabs/eng-4820/remaining-mixpane…
jordankzf Aug 1, 2024
218a3d8
release: v18.4.0
Aug 1, 2024
875b367
Merge pull request #147 from secretkeylabs/release/v18.4.0
jordankzf Aug 1, 2024
7e59352
Merge branch 'develop' into vic/rune-parse-2
terencehh Aug 1, 2024
9b90db4
fix: should default to deny mode for in app send sip10 and any other …
teebszet Aug 8, 2024
77e8cf2
Merge branch 'develop' into vic/send-runes-many
m-aboelenein Aug 8, 2024
6295172
feat: add types for quote slippage and order expiration (#151)
fedeerbes Aug 9, 2024
def5793
release: v18.4.1
Aug 9, 2024
c02bce0
Merge pull request #152 from secretkeylabs/release/v18.4.1
fedeerbes Aug 9, 2024
df4199d
Rename token to selectedToken
jordankzf Aug 12, 2024
e58a2e5
Merge pull request #154 from secretkeylabs/jordankzf/token-protected-…
jordankzf Aug 12, 2024
1e3e348
release: v18.5.0
Aug 12, 2024
f375a8f
Merge pull request #155 from secretkeylabs/release/v18.5.0
jordankzf Aug 12, 2024
e23fb5d
Merge branch 'develop' into vic/send-runes-many
m-aboelenein Aug 14, 2024
6bca6be
Merge pull request #143 from secretkeylabs/vic/send-runes-many
m-aboelenein Aug 14, 2024
8d1911b
release: v18.6.0
Aug 14, 2024
0792f46
Merge pull request #156 from secretkeylabs/release/v18.6.0
m-aboelenein Aug 14, 2024
fcdb1af
Merge pull request #145 from secretkeylabs/vic/rune-parse-2
terencehh Aug 15, 2024
5ccc2ce
release: v18.7.0
Aug 15, 2024
df5e4ff
Merge pull request #157 from secretkeylabs/release/v18.7.0
terencehh Aug 15, 2024
be128a5
Add Stacks Swaps flag
jordankzf Aug 15, 2024
fd7e045
Merge pull request #159 from secretkeylabs/jordankzf/add-stacks-swaps…
jordankzf Aug 15, 2024
b58d8ab
release: v18.7.1
Aug 19, 2024
c08a37a
Merge pull request #160 from secretkeylabs/release/v18.7.1
jordankzf Aug 19, 2024
21b3cef
placeStxOrder and executeStxOrder
jordankzf Aug 20, 2024
9e0c864
Merge branch 'develop' of https://github.com/secretkeylabs/xverse-cor…
jordankzf Aug 20, 2024
dec6fa9
remove stxaddress from ExecuteStxOrderRequest
jordankzf Aug 22, 2024
73cd3cc
Merge pull request #161 from secretkeylabs/jordankzf/place-execute-st…
jordankzf Aug 22, 2024
343eb3b
release: v18.7.2
Aug 23, 2024
845a617
Merge pull request #163 from secretkeylabs/release/v18.7.2
jordankzf Aug 23, 2024
e11503f
export runeId
terencehh Aug 28, 2024
c846161
fix tests
terencehh Aug 28, 2024
ae6367a
Merge pull request #165 from secretkeylabs/terence/add-runeid-to-rune…
terencehh Aug 28, 2024
efb22bd
release: v18.7.3
Aug 28, 2024
f0830d1
Merge pull request #166 from secretkeylabs/release/v18.7.3
terencehh Aug 28, 2024
8f84f92
Add possibleNextNonce helper (#167)
aryzing Aug 29, 2024
28d0867
release: v18.8.0
Aug 29, 2024
58c760b
Merge pull request #168 from secretkeylabs/release/v18.8.0
fedeerbes Aug 29, 2024
2c8e7c2
Add principal optional
jordankzf Aug 30, 2024
e76366c
Merge pull request #169 from secretkeylabs/jordankzf/stacks-swaps-mix…
jordankzf Aug 30, 2024
7f1bd66
release: v18.8.1
Aug 30, 2024
9e6bf26
Merge pull request #170 from secretkeylabs/release/v18.8.1
jordankzf Aug 30, 2024
9eedf62
use the url from the network instance
m-aboelenein Aug 21, 2024
f5c2b56
Revert "Merge branch 'develop' into bug-fix/stacks-network-url"
m-aboelenein Aug 28, 2024
225df9f
add deprecation notice to network helper
m-aboelenein Aug 28, 2024
06b49f1
Revert "Revert "Merge branch 'develop' into bug-fix/stacks-network-url""
m-aboelenein Aug 30, 2024
6844ed1
update dependencies and init stacks api provider
m-aboelenein Aug 30, 2024
c9a3f91
update versions
m-aboelenein Sep 2, 2024
697bfd8
fix network dep
m-aboelenein Sep 2, 2024
879169d
Merge pull request #171 from secretkeylabs/mahmoud/eng-5037-stacking-…
m-aboelenein Sep 2, 2024
a62d7ae
release: v18.9.0
Sep 2, 2024
55f42f1
Merge pull request #174 from secretkeylabs/release/v18.9.0
m-aboelenein Sep 2, 2024
6f42541
Merge pull request #162 from secretkeylabs/bug-fix/stacks-network-url
m-aboelenein Sep 3, 2024
8a79175
Use missing nonces (#172)
aryzing Sep 3, 2024
dd929be
release: v19.0.0
Sep 3, 2024
e7c6618
Merge pull request #177 from secretkeylabs/release/v19.0.0
m-aboelenein Sep 3, 2024
ef1cef2
feat: adjust the threshold for a utxo size that will trigger a split …
teebszet Sep 4, 2024
39b8639
fix: estimate brc20 fees needs to allow 5 byte tickers (#178)
teebszet Sep 5, 2024
ae673c2
release: v19.1.0
Sep 5, 2024
03058fe
Merge pull request #179 from secretkeylabs/release/v19.1.0
fedeerbes Sep 5, 2024
b4f5533
fix: check for post condition deny message
abdulhaseeb4239 Sep 5, 2024
433d3d9
Merge pull request #181 from secretkeylabs/fix/post-condition-deny-me…
abdulhaseeb4239 Sep 6, 2024
fc7428b
release: v19.1.1
Sep 6, 2024
34d10a7
Merge pull request #182 from secretkeylabs/release/v19.1.1
fedeerbes Sep 6, 2024
e974e69
[ENG-4887] Start the Runes Listing Flow
christos-xverse Aug 20, 2024
9417c55
[ENG-4887] Implement Delisting for Multiple Marketplaces
christos-xverse Sep 6, 2024
8019fbb
[ENG-4887] Update per Review
christos-xverse Sep 9, 2024
c5594f6
Merge pull request #164 from secretkeylabs/ENG-4887/start-the-runes-l…
christos-xverse Sep 9, 2024
8f8470d
WIP: fallback to mempool fees if no estimate
m-aboelenein Sep 10, 2024
2e7607b
release: v19.2.0
Sep 10, 2024
06c4dda
Merge pull request #185 from secretkeylabs/release/v19.2.0
christos-xverse Sep 10, 2024
43ca1a0
Merge branch 'develop' into mahmoud/eng-5128-stxcity-token-fails-on-e…
m-aboelenein Sep 10, 2024
31085ff
add filter option for star/hide collectibles (#180)
terencehh Sep 13, 2024
10bc839
release: v19.2.1
Sep 13, 2024
748e61b
Merge pull request #186 from secretkeylabs/release/v19.2.1
fedeerbes Sep 13, 2024
6e8dc03
code review fixes
m-aboelenein Sep 13, 2024
f66b214
added unit tests
m-aboelenein Sep 13, 2024
3d04e55
change test location
m-aboelenein Sep 16, 2024
adbbab9
add error handling
m-aboelenein Sep 16, 2024
04f443d
Merge pull request #184 from secretkeylabs/mahmoud/eng-5128-stxcity-t…
m-aboelenein Sep 16, 2024
d23632c
release: v19.3.0
Sep 16, 2024
7be8585
Merge pull request #187 from secretkeylabs/release/v19.3.0
m-aboelenein Sep 16, 2024
e10d3ff
touchup stacks collection code
terencehh Sep 16, 2024
f66e00e
commit initial work
terencehh Sep 16, 2024
e18eff5
commit initial work
terencehh Sep 16, 2024
acb417b
[ENG-4896] Integrate OKX Listings
christos-xverse Sep 16, 2024
347a7ca
Merge branch 'develop' into ENG-4896/integrate-okx-listings
christos-xverse Sep 16, 2024
c4e4754
add new tests
terencehh Sep 18, 2024
4b24a25
make filter optional
terencehh Sep 18, 2024
7bfc982
Merge pull request #189 from secretkeylabs/ENG-4896/integrate-okx-lis…
christos-xverse Sep 18, 2024
2ce1119
release: v20.0.0
Sep 18, 2024
a8ae8a6
Merge pull request #191 from secretkeylabs/release/v20.0.0
christos-xverse Sep 18, 2024
8983f1c
[ENG-5242] Add Mixpanel Tracking for Multi-Marketplace Listing
christos-xverse Sep 18, 2024
3309116
create dedicated mocks for hidden filters
terencehh Sep 19, 2024
5ee9078
Merge branch 'develop' into terence/hide-star-stx-nfts
terencehh Sep 19, 2024
b771e63
touchup
terencehh Sep 19, 2024
a85ccd5
fix import
terencehh Sep 19, 2024
2aba11b
remove unnneeded variable
terencehh Sep 19, 2024
0114f86
Merge pull request #192 from secretkeylabs/ENG-5242/mixpanel-tracking…
christos-xverse Sep 19, 2024
aae49a9
release: v20.0.1
Sep 19, 2024
8ccd53d
Merge pull request #193 from secretkeylabs/release/v20.0.1
christos-xverse Sep 19, 2024
4504b7f
Merge branch 'develop' into terence/hide-star-stx-nfts
terencehh Sep 19, 2024
f043e31
Merge pull request #188 from secretkeylabs/terence/hide-star-stx-nfts
terencehh Sep 19, 2024
7b87545
release: v20.1.0 (#194)
github-actions[bot] Sep 19, 2024
7a349c9
Add transaction summary parsing - ENG-4810 & ENG-4839 (#149)
victorkirov Sep 20, 2024
6dfc608
release: v21.0.0
Sep 20, 2024
ba0ba8a
Merge pull request #197 from secretkeylabs/release/v21.0.0
fedeerbes Sep 20, 2024
7a8a0a2
add new fiat currencies (#196)
terencehh Sep 24, 2024
c6ea043
fix switzerland symbol (#200)
terencehh Sep 24, 2024
101acc8
release: v21.1.0 (#202)
github-actions[bot] Sep 25, 2024
dea44e3
UTXO cache improvements ENG-4741 (#131)
victorkirov Sep 27, 2024
d602c9a
release: v22.0.0 (#208)
github-actions[bot] Sep 27, 2024
33ce28e
Remove sighash types from sign options (#209)
victorkirov Sep 27, 2024
65e516b
release: v23.0.0 (#210)
github-actions[bot] Sep 27, 2024
fed49d6
Refactor Xverse API client methods to be instance methods instead of …
victorkirov Sep 30, 2024
f32fc2c
[ENG-5340] Export necessary functionality from the extension to core
christos-xverse Oct 1, 2024
598bdaa
Merge pull request #213 from secretkeylabs/ENG-5340/export-necessary-…
christos-xverse Oct 1, 2024
0b491d3
release: v23.0.1
Oct 1, 2024
e22872e
Merge pull request #214 from secretkeylabs/release/v23.0.1
christos-xverse Oct 1, 2024
8c1acc6
Remove a bunch of unused code in prep for Native Segwit (#183)
victorkirov Oct 3, 2024
0eb5c4d
release: v24.0.0 (#217)
github-actions[bot] Oct 3, 2024
f1ff69f
Fix view summary compilation (#219)
victorkirov Oct 4, 2024
eabf626
release: v24.1.0
Oct 7, 2024
67253ca
Merge pull request #223 from secretkeylabs/release/v24.1.0
victorkirov Oct 7, 2024
822ac7e
refactor: gather fungible token derived state into one place (#204)
teebszet Oct 8, 2024
22a4fcd
release: v24.2.0
Oct 8, 2024
d607d67
Merge pull request #224 from secretkeylabs/release/v24.2.0
teebszet Oct 8, 2024
6fbbf18
Merge branch 'develop' into chore/merge-develop-to-public-1728374181
teebszet Oct 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion api/esplora/esploraAPiProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ export class BitcoinEsploraApiProvider {
error?.response?.status === 400 &&
typeof error.response.data === 'string' &&
error.response.data.includes('Too many unspent transaction outputs');
const rateLimitError = error?.response?.status === 429;

if (requestTimedOut || serverError || addressHasTooManyUtxos) {
if (requestTimedOut || serverError || addressHasTooManyUtxos || rateLimitError) {
return this.fallbackBitcoinApi.request({
...error.config,
baseURL: fallbackUrl,
Expand Down
2 changes: 0 additions & 2 deletions api/gamma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ export async function getNftDetail(
export async function getNftsCollectionData(collectionId: string): Promise<NftCollectionData | undefined> {
try {
const apiUrl = `${GAMMA_COLLECTION_API}/${collectionId}?include=floorItem`;

const response = await axios.get<NftCollectionData>(apiUrl, {
timeout: API_TIMEOUT_MILLI,
});

return response.data;
} catch (error) {
return undefined;
Expand Down
2 changes: 1 addition & 1 deletion api/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,10 @@ export function parseStxTransactionData({

/**
* Solves issue wiht proper network address
*
* @param {StacksNetwork} network object to be used for distinguish is user on mainnet or testnet
*
* @returns {string} Network URL to be used
* @deprecated use StacksNetwork().coreApiURL instead
*/
export const getNetworkURL = (network: StacksNetwork): string => {
return network.isMainnet() ? HIRO_MAINNET_DEFAULT : HIRO_TESTNET_DEFAULT;
Expand Down
1 change: 1 addition & 0 deletions api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export * from './stacks';
export * from './utxoCache';
export * from './xverse';
export * from './ordinalsService';
export * from './stacksApi';
1 change: 0 additions & 1 deletion api/ordinals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@
timeout: API_TIMEOUT_MILLI,
transformResponse: [(data) => parseOrdinalTextContentData(data)],
})
.then((response) => response!.data)

Check warning on line 113 in api/ordinals.ts

View workflow job for this annotation

GitHub Actions / test

Forbidden non-null assertion
.catch((error) => {

Check warning on line 114 in api/ordinals.ts

View workflow job for this annotation

GitHub Actions / test

'error' is defined but never used. Allowed unused args must match /^_/u
return '';
});
}
Expand Down Expand Up @@ -142,9 +142,9 @@
})
.then((response) => {
if (response.data) {
const responseTokensList = response!.data;

Check warning on line 145 in api/ordinals.ts

View workflow job for this annotation

GitHub Actions / test

Forbidden non-null assertion
const tokensList: Array<FungibleToken> = [];
responseTokensList.forEach((responseToken: any) => {

Check warning on line 147 in api/ordinals.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
const token: FungibleToken = {
name: responseToken.ticker,
balance: responseToken.overallBalance,
Expand All @@ -155,7 +155,6 @@
ticker: responseToken.ticker?.toUpperCase(),
decimals: 0,
image: '',
visible: true,
supported: true,
tokenFiatRate: null,
protocol: 'brc-20',
Expand All @@ -167,7 +166,7 @@
return [];
}
})
.catch((error) => {

Check warning on line 169 in api/ordinals.ts

View workflow job for this annotation

GitHub Actions / test

'error' is defined but never used. Allowed unused args must match /^_/u
return [];
});
}
Expand Down
12 changes: 6 additions & 6 deletions api/runes/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import {
RuneMarketInfo,
RuneSellRequest,
RuneSellResponse,
runeTokenToFungibleToken,
SubmitCancelOrderRequest,
SubmitCancelOrderResponse,
SubmitRuneSellRequest,
SubmitRunesSellResponse,
} from '../../types';
import { runeTokenToFungibleToken } from '../../fungibleTokens';
import { JSONBig } from '../../utils/bignumber';
import { getXClientVersion } from '../../utils/xClientVersion';

Expand Down Expand Up @@ -93,8 +93,8 @@ class RunesApi {

/**
* Get the balance of all rune tokens an address has
* @param {string} address
* @param {boolean} includeUnconfirmed Set to true to include unconfirmed transactions
* @param address
* @param includeUnconfirmed Set to true to include unconfirmed transactions
* in the balance (default is false)
* @return {Promise<RuneBalance[]>}
*/
Expand All @@ -119,7 +119,7 @@ class RunesApi {
return cachedRuneInfo;
}

let response: AxiosResponse<Rune, any>;
let response: AxiosResponse<Rune, any>; // eslint-disable-line @typescript-eslint/no-explicit-any

if (typeof runeNameOrId === 'bigint') {
const blockHeight = runeNameOrId >> 16n;
Expand All @@ -141,8 +141,8 @@ class RunesApi {

/**
* Get rune details in fungible token format
* @param {string} address
* @param {boolean} includeUnconfirmed Set to true to include unconfirmed transactions
* @param address
* @param includeUnconfirmed Set to true to include unconfirmed transactions
* in the balance (default is false)
* @return {Promise<FungibleToken[]>}
*/
Expand Down
38 changes: 24 additions & 14 deletions api/stacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ import {
} from '../types';
import { getNftDetail } from './gamma';
import {
getNetworkURL,
getUniquePendingTx,
mapTransferTransactionData,
parseMempoolStxTransactionsData,
parseStxTransactionData,
} from './helper';
import { MempoolFeePriorities } from '@stacks/stacks-blockchain-api-types';

// TODO: these methods needs to be refactored
// reference https://github.com/secretkeylabs/xverse-core/pull/217/files#r1298242728
Expand All @@ -68,7 +68,7 @@ export async function getConfirmedTransactions({
}): Promise<StxTransactionListData> {
// deprecated endpoint v1
// reference: https://docs.hiro.so/nakamoto
const apiUrl = `${getNetworkURL(network)}/extended/v1/address/${stxAddress}/transactions`;
const apiUrl = `${network.coreApiUrl}/extended/v1/address/${stxAddress}/transactions`;

const response = await axios.get<StxTransactionResponse>(apiUrl, {
timeout: API_TIMEOUT_MILLI,
Expand All @@ -95,7 +95,7 @@ export async function getMempoolTransactions({
offset: number;
limit: number;
}): Promise<StxMempoolTransactionListData> {
const apiUrl = `${getNetworkURL(network)}/extended/v1/tx/mempool?address=${stxAddress}`;
const apiUrl = `${network.coreApiUrl}/extended/v1/tx/mempool?address=${stxAddress}`;

const response = await axios.get<StxMempoolResponse>(apiUrl, {
timeout: API_TIMEOUT_MILLI,
Expand Down Expand Up @@ -125,7 +125,7 @@ export async function getTransferTransactions(
): Promise<StxTransactionData[]> {
// deprecated endpoint v1
// reference: https://docs.hiro.so/nakamoto
const apiUrl = `${getNetworkURL(network)}/extended/v1/address/${stxAddress}/transactions_with_transfers`;
const apiUrl = `${network.coreApiUrl}/extended/v1/address/${stxAddress}/transactions_with_transfers`;
const response = await axios.get<TransferTransactionsData>(apiUrl, {
timeout: API_TIMEOUT_MILLI,
params: {
Expand All @@ -148,7 +148,7 @@ export async function fetchStxAddressData(
offset: number,
paginationLimit: number,
): Promise<StxAddressData> {
const apiUrl = `${getNetworkURL(network)}/v2/accounts/${stxAddress}?proof=0`;
const apiUrl = `${network.coreApiUrl}/v2/accounts/${stxAddress}?proof=0`;

const balanceInfo = await axios.get<StxAddressDataResponse>(apiUrl, {
timeout: API_TIMEOUT_MILLI,
Expand Down Expand Up @@ -221,7 +221,7 @@ export async function fetchStxAddressData(
}

export async function getFtData(stxAddress: string, network: StacksNetwork): Promise<FungibleToken[]> {
const apiUrl = `${getNetworkURL(network)}/extended/v1/address/${stxAddress}/balances`;
const apiUrl = `${network.coreApiUrl}/extended/v1/address/${stxAddress}/balances`;

const response = await axios.get<TokensResponse>(apiUrl, {
timeout: API_TIMEOUT_MILLI,
Expand All @@ -234,7 +234,6 @@ export async function getFtData(stxAddress: string, network: StacksNetwork): Pro
fungibleToken.assetName = key.substring(index + 2);
fungibleToken.principal = key.substring(0, index);
fungibleToken.protocol = 'stacks';
fungibleToken.visible = new BigNumber(fungibleToken.balance).gt(0);
tokens.push(fungibleToken);
}
return tokens;
Expand All @@ -248,7 +247,7 @@ export async function getFtData(stxAddress: string, network: StacksNetwork): Pro
* @returns
*/
export async function getAccountAssets(stxAddress: string, network: StacksNetwork): Promise<AccountAssetsListData> {
const apiUrl = `${getNetworkURL(network)}/extended/v1/address/${stxAddress}/balances`;
const apiUrl = `${network.coreApiUrl}/extended/v1/address/${stxAddress}/balances`;

return axios
.get<TokensResponse>(apiUrl, {
Expand All @@ -275,7 +274,7 @@ export async function getNftsData(
offset: number,
limit?: number,
): Promise<NftEventsResponse> {
const apiUrl = `${getNetworkURL(network)}/extended/v1/tokens/nft/holdings`;
const apiUrl = `${network.coreApiUrl}/extended/v1/tokens/nft/holdings`;

const response = await axios.get<NftEventsResponse>(apiUrl, {
timeout: 10000,
Expand Down Expand Up @@ -316,7 +315,7 @@ export async function getContractInterface(
network: StacksNetwork,
): Promise<ContractInterfaceResponse | null> {
try {
const apiUrl = `${getNetworkURL(network)}/v2/contracts/interface/${contractAddress}/${contractName}`;
const apiUrl = `${network.coreApiUrl}/v2/contracts/interface/${contractAddress}/${contractName}`;

const response = await axios.get<ContractInterfaceResponse>(apiUrl, {
timeout: API_TIMEOUT_MILLI,
Expand All @@ -330,7 +329,7 @@ export async function getContractInterface(

export async function getBnsName(stxAddress: string, network: StacksNetwork) {
try {
const apiUrl = `${getNetworkURL(network)}/v1/addresses/stacks/${stxAddress}`;
const apiUrl = `${network.coreApiUrl}/v1/addresses/stacks/${stxAddress}`;
const response = await axios.get<AddressToBnsResponse>(apiUrl, {
timeout: API_TIMEOUT_MILLI,
});
Expand Down Expand Up @@ -411,7 +410,7 @@ export async function fetchStxPendingTxData(stxAddress: string, network: StacksN
}

export async function getTransaction(txid: string, network: StacksNetwork): Promise<EsploraTransaction> {
const response = await fetch(`${getNetworkURL(network)}/extended/v1/tx/${txid}`, {
const response = await fetch(`${network.coreApiUrl}/extended/v1/tx/${txid}`, {
method: 'GET',
});
return response.json();
Expand All @@ -434,7 +433,7 @@ export async function fetchDelegationState(stxAddress: string, network: StacksNe
const poxContractName = 'pox-4';
const mapName = 'delegation-state';
const mapEntryPath = `/${poxContractAddress}/${poxContractName}/${mapName}`;
const apiUrl = `${getNetworkURL(network)}/v2/map_entry${mapEntryPath}?proof=0`;
const apiUrl = `${network.coreApiUrl}/v2/map_entry${mapEntryPath}?proof=0`;
const key = cvToHex(tupleCV({ stacker: standardPrincipalCV(stxAddress) }));
const headers = {
'Content-Type': 'application/json',
Expand Down Expand Up @@ -473,11 +472,22 @@ export async function fetchDelegationState(stxAddress: string, network: StacksNe

export async function fetchCoinMetaData(contract: string, network: StacksNetwork) {
try {
const response = await axios.get<CoinMetaData>(`${getNetworkURL(network)}/metadata/ft/${contract}`, {
const response = await axios.get<CoinMetaData>(`${network.coreApiUrl}/metadata/ft/${contract}`, {
timeout: API_TIMEOUT_MILLI,
});
return response?.data;
} catch (err) {
return undefined;
}
}

export const getMempoolFeePriorities = async (network: StacksNetwork): Promise<MempoolFeePriorities> => {
const apiUrl = `${network.coreApiUrl}/extended/v2/mempool/fees`;
const response = await axios.get<MempoolFeePriorities>(apiUrl);
return response.data;
};

export interface FeeEstimation {
fee: number;
fee_rate?: number;
}
Loading
Loading