This repository has been archived by the owner on Jun 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fixing eslint warning; Obtaining swaps configs by note prefix (#122
) * fix: fixing eslint warning; Obtaining swaps configs by note prefix * fix: migrating to dweb.link gateway; more unit tests * fix: ignoring accounts with awvt but without swap configs; minor tweaks * fix: removing typo * fix: testing e2e * fix: remove redundant file * fix: minor additional timeouts for e2e test
- Loading branch information
1 parent
9660a32
commit b598568
Showing
15 changed files
with
139 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { ChainType } from '@/models/Chain'; | ||
import createSaveSwapConfigTxns from './createSaveSwapConfigTxns'; | ||
|
||
import { generateAccount } from 'algosdk'; | ||
|
||
import { LogicSigAccount, encodeAddress } from 'algosdk'; | ||
import getLogicSign from '../accounts/getLogicSignature'; | ||
import { TransactionToSign, TransactionToSignType } from '@/models/Transaction'; | ||
import { dummyContract } from './__utils__/testUtils'; | ||
|
||
describe(`createSaveSwapConfigTxns`, () => { | ||
it(`generates txns correctly`, async () => { | ||
const dummyAccount = generateAccount(); | ||
const dummyLogicSig = getLogicSign(dummyContract) as LogicSigAccount; | ||
|
||
const fundingFee = 10_000; | ||
const dummyCid = `test`; | ||
const txns = await createSaveSwapConfigTxns( | ||
ChainType.TestNet, | ||
dummyAccount.addr, | ||
dummyLogicSig, | ||
fundingFee, | ||
dummyCid, | ||
); | ||
|
||
// First txn | ||
expect((txns[0] as TransactionToSign).signer).toBe(undefined); | ||
expect((txns[0] as TransactionToSign).type).toBe( | ||
TransactionToSignType.UserFeeTransaction, | ||
); | ||
expect( | ||
encodeAddress((txns[0] as TransactionToSign).transaction.from.publicKey), | ||
).toBe(dummyAccount.addr); | ||
expect( | ||
encodeAddress((txns[0] as TransactionToSign).transaction.to.publicKey), | ||
).toBe(dummyLogicSig.address()); | ||
expect((txns[0] as TransactionToSign).transaction.amount).toBe(fundingFee); | ||
|
||
// Second txn | ||
expect((txns[1] as TransactionToSign).signer).toBe(dummyLogicSig); | ||
expect((txns[1] as TransactionToSign).type).toBe( | ||
TransactionToSignType.LsigTransaction, | ||
); | ||
expect( | ||
encodeAddress((txns[1] as TransactionToSign).transaction.from.publicKey), | ||
).toBe(dummyLogicSig.address()); | ||
expect( | ||
encodeAddress((txns[1] as TransactionToSign).transaction.to.publicKey), | ||
).toBe(dummyLogicSig.address()); | ||
expect( | ||
Buffer.from( | ||
(txns[1] as TransactionToSign).transaction.note as any, | ||
`base64`, | ||
).toString(`utf8`), | ||
).toBe(`ipfs://test`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
b598568
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploy preview for algoworld-swapper ready!
✅ Preview
https://algoworld-swapper-gcc4yabnc-algoworldexplorer.vercel.app
Built with commit b598568.
This pull request is being automatically deployed with vercel-action