-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the atomex protocol interface;
Rename the corresponding types; Create a base of the ethereum atomex protocol v1 implementation; Create the corresponding config
- Loading branch information
1 parent
870788f
commit 31e5948
Showing
28 changed files
with
470 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export { Atomex } from './atomex'; | ||
export { AtomexContext } from './atomexContext'; | ||
|
||
export type { AtomexOptions, NewSwapRequest } from './models/index'; | ||
export type { AtomexOptions, NewSwapRequest, AtomexBlockchainOptions } from './models/index'; |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export type { AtomexProtocolV1 } from './atomexProtocolV1'; | ||
export type { InitiateParametersAtomexProtocolV1 } from './initiateParametersAtomexProtocolV1'; | ||
export type { RedeemParametersAtomexProtocolV1 } from './redeemParametersAtomexProtocolV1'; | ||
export type { RefundParametersAtomexProtocolV1 } from './refundParametersAtomexProtocolV1'; | ||
export type { AtomexProtocolV1Options } from './options'; | ||
export type { AtomexProtocolV1InitiateParameters } from './initiateParameters'; | ||
export type { AtomexProtocolV1RedeemParameters } from './redeemParameters'; | ||
export type { AtomexProtocolV1RefundParameters } from './refundParameters'; |
2 changes: 1 addition & 1 deletion
2
...lV1/initiateParametersAtomexProtocolV1.ts → ...in/atomexProtocolV1/initiateParameters.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
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,8 @@ | ||
import type { Currency } from '../../common/index'; | ||
import type { AtomexProtocolOptions } from '../models/index'; | ||
|
||
export interface AtomexProtocolV1Options extends AtomexProtocolOptions { | ||
currencyId: Currency['id']; | ||
swapContractAddress: string; | ||
swapContractBlockId?: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface AtomexProtocolV1RedeemParameters { | ||
readonly secretHash: string; | ||
} |
3 changes: 0 additions & 3 deletions
3
src/blockchain/atomexProtocolV1/redeemParametersAtomexProtocolV1.ts
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
export interface AtomexProtocolV1RefundParameters { | ||
readonly secretHash: string; | ||
} |
3 changes: 0 additions & 3 deletions
3
src/blockchain/atomexProtocolV1/refundParametersAtomexProtocolV1.ts
This file was deleted.
Oops, something went wrong.
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,3 @@ | ||
export interface AtomexProtocolOptions { | ||
atomexProtocolVersion: number; | ||
} |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export type { AtomexProtocolOptions } from './atomexProtocolOptions'; | ||
export type { AtomexSignature } from './atomexSignature'; | ||
export type { Transaction } from './transaction'; |
52 changes: 52 additions & 0 deletions
52
src/ethereum/atomexProtocol/ethereumWeb3AtomexProtocolV1.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,52 @@ | ||
import type BigNumber from 'bignumber.js'; | ||
|
||
import type { | ||
AtomexProtocolV1, AtomexProtocolV1InitiateParameters, AtomexProtocolV1RedeemParameters, AtomexProtocolV1RefundParameters, | ||
Transaction | ||
} from '../../blockchain/index'; | ||
import type { AtomexNetwork, CurrenciesProvider } from '../../common/index'; | ||
import type { DeepReadonly } from '../../core'; | ||
import type { EthereumAtomexProtocolV1Options } from '../models/atomexProtocolOptions'; | ||
|
||
export class EthereumWeb3AtomexProtocolV1 implements AtomexProtocolV1 { | ||
readonly version = 1; | ||
|
||
constructor( | ||
readonly atomexNetwork: AtomexNetwork, | ||
protected readonly currenciesProvider: CurrenciesProvider, | ||
protected readonly atomexProtocolOptions: DeepReadonly<EthereumAtomexProtocolV1Options> | ||
) { | ||
} | ||
|
||
get currencyId() { | ||
return this.atomexProtocolOptions.currencyId; | ||
} | ||
|
||
initiate(params: AtomexProtocolV1InitiateParameters): Promise<Transaction> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
getEstimatedInitiateFees(params: Partial<AtomexProtocolV1InitiateParameters>): Promise<BigNumber> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
redeem(params: AtomexProtocolV1RedeemParameters): Promise<Transaction> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
getRedeemReward(nativeTokenUsdPrice: number, nativeTokenCurrencyPrice: number): Promise<BigNumber> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
getEstimatedRedeemFees(params: Partial<AtomexProtocolV1InitiateParameters>): Promise<BigNumber> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
refund(params: AtomexProtocolV1RefundParameters): Promise<Transaction> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
getEstimatedRefundFees(params: Partial<AtomexProtocolV1InitiateParameters>): Promise<BigNumber> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
} |
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 @@ | ||
export { EthereumWeb3AtomexProtocolV1 } from './ethereumWeb3AtomexProtocolV1'; |
Oops, something went wrong.