-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from CityOfZion/CU-86a5wajzg
CU-86a5wajzg-BS Lib - Implement Swap Log
- Loading branch information
Showing
10 changed files
with
180 additions
and
35 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@cityofzion/blockchain-service/CU-86a5wajzg_2024-12-12-17-38.json
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,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@cityofzion/blockchain-service", | ||
"comment": "Add log in swap response", | ||
"type": "patch" | ||
} | ||
], | ||
"packageName": "@cityofzion/blockchain-service" | ||
} |
10 changes: 10 additions & 0 deletions
10
common/changes/@cityofzion/bs-swap/CU-86a5wajzg_2024-12-12-17-38.json
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,10 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@cityofzion/bs-swap", | ||
"comment": "Add log in swap response", | ||
"type": "patch" | ||
} | ||
], | ||
"packageName": "@cityofzion/bs-swap" | ||
} |
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,58 @@ | ||
import { SimpleSwapApi } from '../apis/SimpleSwapApi' | ||
import { SimpleSwapApiCurrency } from '../types/simpleSwap' | ||
|
||
describe('SimpleSwapApi', () => { | ||
const simpleSwapApi = new SimpleSwapApi() | ||
|
||
const gasCurrency: SimpleSwapApiCurrency<'neo3'> = { | ||
id: 'gasn3:neo3', | ||
ticker: 'gasn3', | ||
symbol: 'gasn3', | ||
network: 'neo3', | ||
name: 'Gas', | ||
imageUrl: 'https://static.simpleswap.io/images/currencies-logo/gasn3.svg', | ||
hash: '0xd2a4cff31913016155e38e474a2c06d08be276cf', | ||
decimals: undefined, | ||
validationAddress: '^(N)[A-Za-z0-9]{33}$', | ||
blockchain: 'neo3', | ||
} | ||
|
||
const neoCurrency: SimpleSwapApiCurrency<'neo3'> = { | ||
id: 'neo3:neo3', | ||
ticker: 'neo3', | ||
symbol: 'NEO', | ||
network: 'neo3', | ||
name: 'NEO', | ||
imageUrl: 'https://static.simpleswap.io/images/currencies-logo/neo3.svg', | ||
hash: 'ef4073a0f2b305a38ec4050e4d3d28bc40ea63f5', | ||
decimals: 0, | ||
validationAddress: '^(N)[A-Za-z0-9]{33}$', | ||
blockchain: 'neo3', | ||
} | ||
|
||
it.skip('Should create the exchange with params', async () => { | ||
const address = process.env.TEST_ADDRESS_TO_SWAP_TOKEN as string | ||
const result = await simpleSwapApi.createExchange(gasCurrency, neoCurrency, '1000', address, address) | ||
|
||
expect(result).toEqual( | ||
expect.objectContaining({ | ||
id: expect.any(String), | ||
depositAddress: expect.any(String), | ||
log: expect.any(String), | ||
}) | ||
) | ||
}) | ||
|
||
it('Should get the exchange by swap id', async () => { | ||
const result = await simpleSwapApi.getExchange(process.env.TEST_SWAP_ID as string) | ||
|
||
expect(result).toEqual( | ||
expect.objectContaining({ | ||
status: expect.any(String), | ||
txFrom: null, | ||
txTo: null, | ||
log: expect.any(String), | ||
}) | ||
) | ||
}) | ||
}) |
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
18 changes: 18 additions & 0 deletions
18
packages/bs-swap/src/__tests__/SimpleSwapServiceHelper.spec.ts
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,18 @@ | ||
import { SimpleSwapServiceHelper } from '../helpers/SimpleSwapServiceHelper' | ||
|
||
describe('SimpleSwapServiceHelper', () => { | ||
const simpleSwapServiceHelper = new SimpleSwapServiceHelper() | ||
|
||
it('Should get the swap status by swap id', async () => { | ||
const result = await simpleSwapServiceHelper.getStatus(process.env.TEST_SWAP_ID as string) | ||
|
||
expect(result).toEqual( | ||
expect.objectContaining({ | ||
status: expect.any(String), | ||
txFrom: null, | ||
txTo: null, | ||
log: expect.any(String), | ||
}) | ||
) | ||
}) | ||
}) |
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