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

Feat/sync 20241204 #41

Closed
wants to merge 373 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
373 commits
Select commit Hold shift + click to select a range
ade20e4
fix: sign to encode for dapps (#329)
liammcaweeney Aug 26, 2024
f307981
Version packages
xdefi-bot Aug 26, 2024
1ec27d8
fix: logic to handle getAccount errors (#336)
sotatek-tyler-nguyen4 Aug 27, 2024
1bd3c8a
chore: Add documentation for afterBlock when using getBalance with RP…
sotatek-tyler-nguyen4 Aug 27, 2024
da2c5f9
Version packages
xdefi-bot Aug 27, 2024
86c9a05
chore: align fee estimation on ChainDatasource with IndexDatasource (…
sotatek-tyler-nguyen4 Aug 27, 2024
352b426
fix: estimateFee for stargaze NFTs (#338)
sotatek-tyler-nguyen4 Aug 27, 2024
b62252e
Version packages
xdefi-bot Aug 27, 2024
7fe13ef
chore: align HW signers & SeedPhrase signer with the PK signer (#321)
sotatek-tyler-nguyen4 Aug 27, 2024
65992ee
feat: fix typescript error (#297)
sotatek-tyler-nguyen4 Aug 27, 2024
7696ace
Version packages
xdefi-bot Aug 27, 2024
38fd91d
feat: add logic to calculate gasPrice when not provided (#293)
sotatek-tyler-nguyen4 Aug 27, 2024
cb3f96d
Version packages
xdefi-bot Aug 27, 2024
4507752
feat: update cosmos sign + estimateFee to automatically adapt inputs …
liammcaweeney Aug 28, 2024
26ad49a
Version packages
xdefi-bot Aug 28, 2024
2c670fd
Chore/cosmos/auto adapt ibc msg (#342)
liammcaweeney Aug 28, 2024
3e0a97d
Version packages
xdefi-bot Aug 28, 2024
f573826
fix: buildTx when maxPriorityFeePerGas is 0 (#343)
danilxdefi Aug 29, 2024
f495ee9
Version packages
xdefi-bot Aug 29, 2024
f3e48f0
fix: fee estimation for mayachain chain.datasource (#344)
danilxdefi Aug 29, 2024
97953cf
Version packages
xdefi-bot Aug 29, 2024
4310437
fix: asset.decimals field for indexer data-source (#346)
danilxdefi Aug 29, 2024
9f12ca0
Version packages
xdefi-bot Aug 29, 2024
d4ce2c0
feat: add xdefi-trace-id to debug gql issues (#345)
danilxdefi Aug 29, 2024
91d82c9
Version packages
xdefi-bot Aug 29, 2024
fe45f8c
fix: added MsgExecuteContract plus sanitiseMsg util (#349)
liammcaweeney Aug 30, 2024
661fd7f
Version packages
xdefi-bot Aug 30, 2024
c7c04bf
fix: add getAccountResource to base datasource to use it in FallbackD…
danilxdefi Sep 3, 2024
30edf24
Version packages
xdefi-bot Sep 3, 2024
b1b47d0
fix: return null for getFee method (#352)
danilxdefi Sep 3, 2024
2ef708c
Version packages
xdefi-bot Sep 3, 2024
9959cbc
feat: add dataSourceList to tron provider (#353)
danilxdefi Sep 3, 2024
1873618
Version packages
xdefi-bot Sep 3, 2024
8bade72
Version packages (#354)
liammcaweeney Sep 3, 2024
7edbf93
Version packages
xdefi-bot Sep 3, 2024
8849045
feat: add updated demo app (#356)
danilxdefi Sep 6, 2024
a00d75d
fix: update buildTx to avoid can't get EIP1559 gas fee error (#355)
danilxdefi Sep 6, 2024
9a1f29b
Version packages
xdefi-bot Sep 6, 2024
36adff0
chore: Pass preflight settings from params for Solana chain (#347)
sotatek-tyler-nguyen4 Sep 9, 2024
8662c8f
Version packages
xdefi-bot Sep 9, 2024
5c123b4
fix: add memo to utxo chains using @scure/btc-signer (#360)
danilxdefi Sep 11, 2024
f437817
Version packages
xdefi-bot Sep 11, 2024
d692a89
feat: return balance of native token on custom cosmos chains (#357)
sotatek-tyler-nguyen4 Sep 11, 2024
065f338
Version packages
xdefi-bot Sep 11, 2024
14f2186
fix: add maxPriorityFeePerGas default value to 1 gwei (#363)
danilxdefi Sep 11, 2024
5631480
Version packages
xdefi-bot Sep 11, 2024
28667a2
fix: include missing dependencies to fix externals (#364)
janicduplessis Sep 11, 2024
15dc577
Version packages
xdefi-bot Sep 11, 2024
fb88206
feat(thor): rename chain id after hard fork (#367)
davidp94 Sep 12, 2024
f612ab4
Version packages
xdefi-bot Sep 12, 2024
9604473
fix: add hash to transaction from broadcast method (#368)
danilxdefi Sep 12, 2024
4439cdf
Version packages
xdefi-bot Sep 12, 2024
b1def15
fix: rounding amount before get trsanfer route (#359)
sotatek-tyler-nguyen4 Sep 13, 2024
5c551d8
Version packages
xdefi-bot Sep 13, 2024
a895fc4
fix: broadcast solana tx (#370)
danilxdefi Sep 16, 2024
62a461a
Version packages
xdefi-bot Sep 16, 2024
fb2ef1c
fix: signing method not taking segwit txs into account (#358)
sotatek-tyler-nguyen4 Sep 20, 2024
ebc3609
Version packages
xdefi-bot Sep 20, 2024
66c73b9
fix: return chain msg instead of msg body (#372)
sotatek-tyler-nguyen4 Sep 23, 2024
91aafb0
Version packages
xdefi-bot Sep 23, 2024
3f6ec67
fix: thor chain signing for FallbackDataSource (#371)
danilxdefi Sep 23, 2024
2744c49
Version packages
xdefi-bot Sep 23, 2024
a2ccbfa
fix: update tron msg.getFee method (#375)
danilxdefi Sep 26, 2024
2383b47
Version packages
xdefi-bot Sep 26, 2024
a27eec5
fix: create TrezorSigner example & update TrezorSigner unitest (#369)
sotatek-tyler-nguyen4 Sep 26, 2024
490f640
chore: create tests from multisign on solana (#272)
sotatek-tyler-nguyen4 Sep 26, 2024
2e7a897
Version packages
xdefi-bot Sep 26, 2024
9e59f80
fix: getTransaction status for tron chain (#378)
danilxdefi Sep 26, 2024
142389f
Version packages
xdefi-bot Sep 26, 2024
90cf30e
fix: add multiple to evm gas estimate that has contractAddress in pay…
liammcaweeney Sep 26, 2024
3682a3e
Version packages
xdefi-bot Sep 26, 2024
d8be477
fix: sign transfer with ledger on Thorchain (#373)
sotatek-tyler-nguyen4 Sep 26, 2024
b9ea789
Version packages
xdefi-bot Sep 26, 2024
251212b
feat: add fallback asset fetcher for custom chain (#377)
sotatek-tyler-nguyen4 Sep 26, 2024
954de5a
Version packages
xdefi-bot Sep 26, 2024
179c316
fix: thorchain decimals for indexer datasource (#380)
danilxdefi Sep 27, 2024
34dfdd2
Version packages
xdefi-bot Sep 27, 2024
bb2e4d0
fix: solana ledger signer (#382)
sotatek-tyler-nguyen4 Sep 30, 2024
d92f4d1
Version packages
xdefi-bot Sep 30, 2024
e1c663c
Feat/xdefi 10928/reflect data from cryptoasset type to get balance re…
dan-ivanchenko Sep 30, 2024
39c9095
feat: add ethereum message signing method (#383)
sotatek-tyler-nguyen4 Sep 30, 2024
d4fd17f
Version packages
xdefi-bot Sep 30, 2024
3b39cb7
fix: estimate gas in data sources (#374)
sotatek-tyler-nguyen4 Oct 1, 2024
53d7c85
Version packages
xdefi-bot Oct 1, 2024
f3f7b33
fix: blockhash was out of date (#385)
liammcaweeney Oct 2, 2024
b852ec4
Version packages
xdefi-bot Oct 2, 2024
d10121f
fix: update fees calculation for thor/maya chains (#388)
danilxdefi Oct 3, 2024
575924e
Version packages
xdefi-bot Oct 3, 2024
87a2fbb
fix: manifest decimals for Tron chain (#389)
danilxdefi Oct 3, 2024
5c33caa
Version packages
xdefi-bot Oct 3, 2024
8d265c6
fix: manifest decimals for Tron chain (#390)
danilxdefi Oct 3, 2024
cfa93a6
Version packages
xdefi-bot Oct 3, 2024
3f42da2
fix: avoid modifying data.from field inside estimateFee method for tr…
danilxdefi Oct 3, 2024
2a63353
Version packages
xdefi-bot Oct 3, 2024
1105fe4
fix: Solana Max Send Issue Due to Rent Requirement Miscalculation (#392)
sotatek-tyler-nguyen4 Oct 4, 2024
263e890
Version packages
xdefi-bot Oct 4, 2024
4356a92
feat: create ctrl data source (#316)
sotatek-tyler-nguyen4 Oct 7, 2024
0cb02f7
Version packages
xdefi-bot Oct 7, 2024
e31f864
fix: error when sending secondary tokens on THORChain ledger (#394)
sotatek-tyler-nguyen4 Oct 8, 2024
cd01204
Version packages
xdefi-bot Oct 8, 2024
a92343b
Fix/btc max send (#393)
liammcaweeney Oct 8, 2024
7fda3ba
Version packages
xdefi-bot Oct 8, 2024
43b393c
fix: int divided by int can lead to a decimal, math.ceil fixes (#395)
liammcaweeney Oct 8, 2024
785c47f
Version packages
xdefi-bot Oct 8, 2024
075d741
fix: XDEFI-9341 Thorchain transactions ledger (#396)
loxator Oct 8, 2024
8a60604
Version packages
xdefi-bot Oct 8, 2024
347a66c
chore: increased default contract fee from 100k to 1mill (#400)
liammcaweeney Oct 9, 2024
8e2eb95
Version packages
xdefi-bot Oct 9, 2024
966023f
fix: getTransaction method for EVM chain (#401)
danilxdefi Oct 9, 2024
f894550
chore: XDEFI-10371 Overwrite ETH token data for custom networks if na…
loxator Oct 9, 2024
0c683ed
fix: getTransaction method for EVM chain (#402)
danilxdefi Oct 9, 2024
2cda3e5
fix: lint
danilxdefi Oct 9, 2024
73ddd9f
Version packages
xdefi-bot Oct 9, 2024
0cea024
feat: get energy & bandwidth price from rpc (#399)
sotatek-tyler-nguyen4 Oct 9, 2024
7bf7473
Version packages
xdefi-bot Oct 9, 2024
26a578d
fix: move estimateEnergy method to utils for tron chains (#406)
danilxdefi Oct 11, 2024
7143bb6
Version packages
xdefi-bot Oct 11, 2024
600333f
feat: update getMaxAmountToSend method XDEFI-11263,XDEFI-11224,XDEFI-…
sotatek-tyler-nguyen4 Oct 17, 2024
c182a5b
Version packages
xdefi-bot Oct 17, 2024
a525522
feat: Implement TRON signTransaction and fee estimation (#408)
sotatek-tyler-nguyen4 Oct 17, 2024
61e566d
Version packages
xdefi-bot Oct 17, 2024
604a9be
feat: implement signMessage for hot and hardware wallets (#411)
sotatek-tyler-nguyen4 Oct 17, 2024
bcd8679
Apply EVM indexers changes (#410)
sotatek-tyler-nguyen4 Oct 17, 2024
5e0537f
fix: Removing unnecessary type assertions (#398)
sotatek-tyler-nguyen4 Oct 17, 2024
7f12656
Version packages
xdefi-bot Oct 17, 2024
aeb8b78
fix: Signing P2SH transactions for UTXO Ledger fails (#403)
sotatek-tyler-nguyen4 Oct 17, 2024
78f3c29
fix: remove sign message in solana ledger signer (#386)
sotatek-tyler-nguyen4 Oct 17, 2024
7fc1a1c
chore: update workflow test (#387)
sotatek-tyler-nguyen4 Oct 17, 2024
6dd1a54
Version packages
xdefi-bot Oct 17, 2024
6b21b36
feat: update trezor lib & create Solana trezor signer (#384)
sotatek-tyler-nguyen4 Oct 17, 2024
fc4d971
XDEFI-9648: test coverage networked requests (not mocked) (#335)
JamesNguyen5 Oct 17, 2024
759cf4c
Version packages
xdefi-bot Oct 17, 2024
3f7e518
chore: remove custom terra code (#317)
sotatek-tyler-nguyen4 Oct 17, 2024
d78240f
Version packages
xdefi-bot Oct 17, 2024
eda7c4b
fix: fee estimation for transaction not send trx (#412)
sotatek-tyler-nguyen4 Oct 18, 2024
2a5f1d9
Version packages
xdefi-bot Oct 18, 2024
89bf9fc
chore: export ctrl data source (#414)
liammcaweeney Oct 18, 2024
471126a
Version packages
xdefi-bot Oct 18, 2024
b960d5c
feat: update MATIC to POL for polygon chain (#415)
danilxdefi Oct 18, 2024
ed4f880
Version packages
xdefi-bot Oct 18, 2024
725b8bc
fix: getNonce for ctrlDatasource (#416)
liammcaweeney Oct 21, 2024
5a4d884
Version packages
xdefi-bot Oct 21, 2024
2090793
fix: updated parseGwei to handle exponential number (#417)
liammcaweeney Oct 21, 2024
58b563f
Version packages
xdefi-bot Oct 21, 2024
dffa732
fix: too many bytes to encode when ledger sign trasaction (#419)
sotatek-tyler-nguyen4 Oct 22, 2024
5397efc
Version packages
xdefi-bot Oct 22, 2024
6ee7e79
fix: kava chain manifest (#420)
danilxdefi Oct 22, 2024
2611f0a
Version packages
xdefi-bot Oct 22, 2024
6c056ef
feat: Implement signPsbt for hot wallets (#413)
sotatek-tyler-nguyen4 Oct 23, 2024
f3b27a1
fix: eslint error (#422)
sotatek-tyler-nguyen4 Oct 23, 2024
fe333d1
Version packages
xdefi-bot Oct 23, 2024
652ff05
fix: tron coverage tests
liammcaweeney Oct 23, 2024
1f41efb
feat: add broadcast PSBT method (#424)
sotatek-tyler-nguyen4 Oct 24, 2024
4f1b3ec
Version packages
xdefi-bot Oct 24, 2024
cd5c67d
Test apollo changes (#348)
sotatek-tyler-nguyen4 Oct 24, 2024
73cd558
fix: fee calculation XDEFI-11171 (#405)
taran-a Oct 24, 2024
95dffd2
Version packages
xdefi-bot Oct 24, 2024
9a2be63
fix: ledger signAnimo for dapp tx on cosmos (#426)
sotatek-tyler-nguyen4 Oct 24, 2024
682c87f
Version packages
xdefi-bot Oct 24, 2024
b2b114e
bump: version for XDEFI-9999 (#428)
danilxdefi Oct 24, 2024
1ae86d1
Version packages
xdefi-bot Oct 24, 2024
0b40a25
fix: ledger sign send tx (#430)
sotatek-tyler-nguyen4 Oct 24, 2024
9602000
Version packages
xdefi-bot Oct 24, 2024
13d5fa1
fix: lint (#431)
davidp94 Oct 24, 2024
0137860
Version packages
xdefi-bot Oct 24, 2024
5346d72
fix: add error handling logic for signing failures (#433)
sotatek-tyler-nguyen4 Oct 26, 2024
1c2861f
fix: get fee error XDEFI-11181 (#434)
sotatek-tyler-nguyen4 Oct 26, 2024
0e33d8c
Version packages
xdefi-bot Oct 26, 2024
2c565b1
fix: estimate dapp tx error (#435)
sotatek-tyler-nguyen4 Oct 26, 2024
c5417bf
Version packages
xdefi-bot Oct 26, 2024
bec58b8
fix: invalid hex number error 0x0 (#436)
sotatek-tyler-nguyen4 Oct 26, 2024
ea5c83d
Version packages
xdefi-bot Oct 26, 2024
d299ab3
fix: extract asset errro when creating deposit msg (#438)
sotatek-tyler-nguyen4 Oct 28, 2024
93247e3
Version packages
xdefi-bot Oct 28, 2024
1b4b325
fix: filter out expensive inputs
liammcaweeney Oct 31, 2024
3e0e1dc
fix: tests
liammcaweeney Oct 31, 2024
0b9a45f
chore: bump
liammcaweeney Oct 31, 2024
d6b8f26
Version packages
xdefi-bot Oct 31, 2024
9e738de
fix: lint
liammcaweeney Oct 31, 2024
0a0bd44
Version packages
xdefi-bot Oct 31, 2024
2941756
fix: lint
liammcaweeney Oct 31, 2024
8b80e73
Version packages
xdefi-bot Oct 31, 2024
503170e
fix: increase gasLimit for avax by 20%
liammcaweeney Oct 31, 2024
10f9fc5
Version packages
xdefi-bot Oct 31, 2024
9208d13
fix: XDEFI-11606 trezor deps (#446)
danilxdefi Nov 1, 2024
f390481
Version packages
xdefi-bot Nov 1, 2024
b75bf78
fix: XDEFI-11204 Update chain data source to handle missing address c…
loxator Nov 4, 2024
e104b78
Version packages
xdefi-bot Nov 4, 2024
25a1ed5
fix: build and change key from name to chain for finding custom cosmo…
loxator Nov 5, 2024
a76d3ce
Version packages
xdefi-bot Nov 5, 2024
539edb6
fix: caching policy for the balance query (#447)
sotatek-tyler-nguyen4 Nov 6, 2024
9d7164c
Version packages
xdefi-bot Nov 6, 2024
e627b87
draft: use getFeeForMessage for calculating solana fees (#437)
danilxdefi Nov 7, 2024
367493e
Version packages
xdefi-bot Nov 7, 2024
74f993f
fix: add fee ratio to getMaxAmountToSend (#450)
danilxdefi Nov 7, 2024
4047d7a
Version packages
xdefi-bot Nov 7, 2024
a13d91b
fix: update solana broadcast to use serialized tx from signer (#452)
liammcaweeney Nov 8, 2024
4072d0b
Version packages
xdefi-bot Nov 8, 2024
87554ee
fix: estimate fee for EVM chains (#453)
danilxdefi Nov 11, 2024
e3d5a92
fix: xdefi-11305 gas limit (#454)
danilxdefi Nov 12, 2024
1058b0e
Version packages
xdefi-bot Nov 12, 2024
a32c33a
feat: add chains-lib core options support (#455)
sotatek-tyler-nguyen4 Nov 12, 2024
a868715
Version packages
xdefi-bot Nov 12, 2024
d351f8a
feat: add getPriorityFeeEstimate (#456)
liammcaweeney Nov 12, 2024
1bc25f2
Version packages
xdefi-bot Nov 12, 2024
23f6668
fix: XDEFI-11818 (#458)
loxator Nov 13, 2024
711a4d3
Version packages
xdefi-bot Nov 13, 2024
bc18814
fix: XDEFI-11812 chains core options (#461)
danilxdefi Nov 13, 2024
842e76b
Version packages
xdefi-bot Nov 13, 2024
45a8f7c
fix: XDEFI-11783 TREZOR: ' Invalid parameter domain_separator_hash (=…
loxator Nov 14, 2024
9b48402
Version packages
xdefi-bot Nov 14, 2024
c54adeb
fix: txs failed while sending with memo using Trezor (#457)
sotatek-tyler-nguyen4 Nov 14, 2024
1e40034
Version packages
xdefi-bot Nov 14, 2024
5bab744
fix: update getMaxAmountToSend for non-native evm tokens (#425)
danilxdefi Nov 14, 2024
3ac8348
Version packages
xdefi-bot Nov 14, 2024
10f3981
feat: add timeout after broadcast transaction
liammcaweeney Nov 14, 2024
4747db7
fix: updated getSignatureStatus fn
liammcaweeney Nov 14, 2024
aa235ac
fix: updated getSignatureStatus to getSignatureStatuses
liammcaweeney Nov 14, 2024
d2a23b4
chore: added comment
liammcaweeney Nov 14, 2024
e43c912
Version packages
xdefi-bot Nov 14, 2024
c5e0746
fix: add validate for custom fee info (#463)
sotatek-tyler-nguyen4 Nov 15, 2024
20cdb67
Version packages
xdefi-bot Nov 15, 2024
758b836
chore: add serializedTx to sign for sol hw signer XDEFI-11913 (#465)
liammcaweeney Nov 15, 2024
afea55d
Version packages
xdefi-bot Nov 15, 2024
ffbb859
feat: Reduce cache balance to 1 minute (#464)
JamesNguyen5 Nov 18, 2024
8897d3b
Version packages
xdefi-bot Nov 18, 2024
797484b
fix: added value to estimate gasLimit for value for native txs with d…
liammcaweeney Nov 18, 2024
c4f37de
fix: evm tests
liammcaweeney Nov 18, 2024
b5de741
Version packages
xdefi-bot Nov 18, 2024
d01e164
chore: Update to how fees are calculated on EVM
liammcaweeney Nov 19, 2024
97bd860
fix: commented out no longer relevant tests
liammcaweeney Nov 19, 2024
d632a04
Version packages
xdefi-bot Nov 19, 2024
63b4423
feat: disable waitFor for evm chain (#469)
danilxdefi Nov 20, 2024
c82e3f9
Version packages
xdefi-bot Nov 20, 2024
1f08e01
fix: updated signer to add blockhash
liammcaweeney Nov 21, 2024
e1f3b17
fix: added for all signers
liammcaweeney Nov 21, 2024
360d7e7
Version packages
xdefi-bot Nov 21, 2024
2c0751a
fix: calculate data field for gas limit estimation for EVM chain (#472)
danilxdefi Nov 21, 2024
493213e
Version packages
xdefi-bot Nov 21, 2024
c3c0a4b
fix: fee estimation method for evm chain (#473)
danilxdefi Nov 21, 2024
0574f77
Version packages
xdefi-bot Nov 21, 2024
1110bbf
feat: update dustThreshold formula (#474)
danilxdefi Nov 22, 2024
e964f24
Version packages
xdefi-bot Nov 22, 2024
ee20ae8
fix: sol wait 10s-20s before broadcasting again
liammcaweeney Nov 25, 2024
7d5d03a
Version packages
xdefi-bot Nov 25, 2024
e1eb283
fix: the msg type for maya/thor ledger
liammcaweeney Nov 28, 2024
724f5af
Version packages
xdefi-bot Nov 28, 2024
a2d4d21
feat: add all broadcast options to solana package (#478)
danilxdefi Dec 2, 2024
1ea477e
Version packages
xdefi-bot Dec 2, 2024
d70ee11
fix: ledger desposit for thor
liammcaweeney Dec 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 26 additions & 0 deletions .github/workflows/daily-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Daily CI/CD Tests

on:
schedule:
- cron: '0 0 * * *'

jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GIT_TOKEN }}

- name: Enable node
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install dependencies
run: yarn

- name: Run tests
run: yarn test:cicd --concurrency 2

22 changes: 22 additions & 0 deletions .github/workflows/size-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'size'

on:
pull_request:
branches:
- develop
jobs:
size:
runs-on: ubuntu-latest
env:
CI_JOB_NUMBER: 1

steps:
- uses: actions/checkout@v3
- name: Enable node
uses: actions/setup-node@v3
with:
node-version: 20.12.0
- uses: andresz1/[email protected]
with:
github_token: ${{ secrets.GIT_TOKEN }}
build_script: size-build
29 changes: 27 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
uses: actions/checkout@v3
# with:
# token: ${{ secrets.GIT_TOKEN }}
# fetch-depth: 0

- name: Enable node
uses: actions/setup-node@v3
Expand All @@ -22,12 +23,36 @@ jobs:
- name: Setup Python for Deps
run: sudo apt-get update && sudo apt-get install python3-dev -y

- name: Determine changed packages using Changesets
id: changes
run: |
set -e # Ensure the script exits on error
changed_packages=$(npx -y changeset status --since origin/develop | grep '@xdefi-tech/' | cut -d'/' -f2 | sort -u | tr '\n' ',')
changed_packages=${changed_packages%,} # Remove trailing comma
if [ -z "$changed_packages" ]; then
echo "No changesets found. Testing all packages."
echo "changed_packages=all" >> $GITHUB_ENV
else
echo "changed_packages=$changed_packages" >> $GITHUB_ENV
fi

- name: Build
if: env.changed_packages != ''
run: yarn build --concurrency 2

- name: Run tests
run: yarn test --concurrency 2
- name: Run tests for changed packages
run: |
if [ "${{ env.changed_packages }}" = "all" ]; then
yarn test --concurrency 2
else
for package in $(echo ${{ env.changed_packages }} | tr ',' '\n'); do
echo "Running tests for package: @xdefi-tech/$package"
yarn workspace @xdefi-tech/$package test
done
fi

- name: Upload coverage reports to Codecov
if: env.changed_packages != ''
uses: codecov/[email protected]
env:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ yarn-error.log*
.pnpm-debug.log*

# local env files
*.env
.env.local
.env.development.local
.env.test.local
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ npm install @xdefi-tech/chains
yarn add @xdefi-tech/chains
```

## Environment Setup

The `NETWORKED_QUERIES` environment variable is used to control the behavior of network requests in tests. By default, `NETWORKED_QUERIES` is set to `0`, which means that all network requests are mocked, allowing tests to run without actual network dependencies. This ensures that tests are faster, more reliable, and not affected by external factors such as network latency or availability of external services. Setting `NETWORKED_QUERIES` to `1` enables real network requests, allowing tests to interact with actual external services. This can be useful for integration tests where end-to-end verification of network interactions is required. To configure this setting, simply add `NETWORKED_QUERIES=0` or `NETWORKED_QUERIES=1` to your `.env` file as needed.

## Manifest

Each provider may have different manifests, but they share common fields. For more details, please refer to the README of the respective provider.
Expand Down
19 changes: 19 additions & 0 deletions examples/node/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// should be before import any other chain lib modules
global.CHAINS_CORE_OPTIONS = {
httpUri: 'https://gql-router.xdefi.services/graphql',
wsUri: 'wss://gateway-ws.xdefi.services/',
clientName: 'chain-lib-node-example',
clientVersion: '0.0.1',
}
const { EVM_MANIFESTS, EvmProvider } = require('@xdefi-tech/chains-evm');
const XMLHttpRequest = require('xhr2');

global.XMLHttpRequest = XMLHttpRequest;

async function main() {
const provider = new EvmProvider(new EvmProvider.dataSourceList.IndexerDataSource(EVM_MANIFESTS.ethereum));
const balance = await provider.getBalance('0xb68E7481eb29477a2370803569EA6C65E54921E9');
const data = await balance.getData();
}

main();
27 changes: 27 additions & 0 deletions examples/node/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "node",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"@xdefi-tech/chains-binance": "*",
"@xdefi-tech/chains-bitcoin": "*",
"@xdefi-tech/chains-bitcoincash": "*",
"@xdefi-tech/chains-controller": "*",
"@xdefi-tech/chains-core": "*",
"@xdefi-tech/chains-cosmos": "*",
"@xdefi-tech/chains-dogecoin": "*",
"@xdefi-tech/chains-evm": "*",
"@xdefi-tech/chains-litecoin": "*",
"@xdefi-tech/chains-solana": "*",
"@xdefi-tech/chains-thor": "*",
"@xdefi-tech/chains-tron": "*",
"xhr2": "^0.2.1"
}
}
136 changes: 47 additions & 89 deletions examples/react/components/balances.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,31 @@ import {
Box,
Typography,
Button,
Divider,
List,
ListItemAvatar,
ListItem,
ListItemText,
} from '@mui/material';
import { Coin, Chain } from '@xdefi-tech/chains-core';
import { isEmpty } from 'lodash';
import HowToContainer from './containers/how-to.container';

export interface IBalancesComponent {
provider: Chain.Provider;
address: string;
tokenList: string[];
children?: React.ReactNode;
}

const BalancesComponent = (props: IBalancesComponent) => {
const [balances, setBalances] = useState<Coin[]>([]);
const [balanceError, setBalanceError] = useState<null | string>(null);
const [balanceLoader, setBalanceLoader] = useState<boolean>(false);
const [subscription, setSubscription] = useState(null);
const [lastUpdate, setLastUpdate] = useState<Date | null>(null);
useEffect(() => {
handleUnsubscribe();
}, [props.address, props.provider, props.tokenList]);

useEffect(() => {
setBalanceError(null);
}, [props.address]);

const handleUnsubscribe = useCallback(() => {
if (subscription) {
subscription.unsubscribe();
setSubscription(null);
}
setBalanceError(null);
}, [subscription]);

const handleBalanceClick = useCallback(async () => {
try {
setBalanceLoader(true);
Expand All @@ -63,32 +51,9 @@ const BalancesComponent = (props: IBalancesComponent) => {
}
}, [props.address, props.provider, props.tokenList]);

const handleStreamingClick = useCallback(async () => {
try {
if (subscription) {
handleUnsubscribe();
return;
}
if (isEmpty(balances)) {
await handleBalanceClick();
}
const balanceResponse = await props.provider.getBalance(props.address);
const balanceObserver = await balanceResponse.getObserver();
setSubscription(
balanceObserver.subscribe((data) => {
// todo create and update subs list
console.log('subscription data', data);
})
);
} catch (err) {
setBalanceError(err.message);
setSubscription(null);
}
}, [balances, subscription, props.address, props.provider]);

return (
<Box>
<Typography variant="h4">Balances</Typography>
<Typography variant="h6">Balances</Typography>

<Box>
<Button
Expand All @@ -97,63 +62,56 @@ const BalancesComponent = (props: IBalancesComponent) => {
>
Set Balances
</Button>
<Button
onClick={handleStreamingClick}
disabled={balanceLoader || Boolean(balanceError)}
>
{subscription ? 'Disable' : 'Enable'} Stream
</Button>
</Box>

{balanceError && <Typography color="red">{balanceError}</Typography>}

{lastUpdate && (
<Typography color="gray">
{lastUpdate.toDateString()} {lastUpdate.toTimeString()}
</Typography>
)}
{balances.length > 0 && (
<>
{lastUpdate && (
<Typography color="gray">
{lastUpdate.toDateString()} {lastUpdate.toTimeString()}
</Typography>
)}

<List
component="div"
sx={{
width: '100%',
bgcolor: 'background.paper',
maxHeight: 500,
overflow: 'auto',
}}
>
{balances.map((coin: Coin) => {
const priceInUsd = coin.asset.price
? `${coin.amount.multipliedBy(coin.asset.price).toFixed(2)}$`
: 'N/A';
return (
<ListItem button key={coin.asset.id || coin.asset.symbol}>
<ListItemAvatar>
<img
width="30"
height="30"
src={coin.asset.icon}
alt={coin.asset.symbol}
/>
</ListItemAvatar>
<Typography>{coin.asset.symbol}</Typography>
<ListItemText
primary={coin.amount.toFixed(8)}
secondary={priceInUsd}
sx={{ textAlign: 'end' }}
/>
</ListItem>
);
})}
</List>
<List
component="div"
sx={{
width: '100%',
bgcolor: 'background.paper',
maxHeight: 500,
overflow: 'auto',
marginBottom: '1em',
}}
>
{balances.map((coin: Coin) => {
const priceInUsd = coin.asset.price
? `${coin.amount.multipliedBy(coin.asset.price).toFixed(2)}$`
: 'N/A';
return (
<ListItem button key={coin.asset.id || coin.asset.symbol}>
<ListItemAvatar>
<img
width="30"
height="30"
src={coin.asset.icon}
alt={coin.asset.symbol}
/>
</ListItemAvatar>
<Typography>{coin.asset.symbol}</Typography>
<ListItemText
primary={coin.amount.toFixed(8)}
secondary={priceInUsd}
sx={{ textAlign: 'end' }}
/>
</ListItem>
);
})}
</List>
</>
)}

<Divider
sx={{
borderWidth: 3,
my: 3,
borderRadius: 10,
}}
/>
<HowToContainer title="get balances?">{props.children}</HowToContainer>
</Box>
);
};
Expand Down
Loading
Loading