Skip to content

Commit

Permalink
Implement most of the RemoteWallet functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
popzxc committed Jan 28, 2022
1 parent 2cf7c9f commit 22fcca3
Show file tree
Hide file tree
Showing 3 changed files with 402 additions and 434 deletions.
67 changes: 1 addition & 66 deletions sdk/zksync.js/src/abstract-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import { Transaction, ETHOperation } from './operations';
export abstract class AbstractWallet {
public provider: SyncProvider;

protected constructor(public cachedAddress: Address, public accountId?: number) {}
protected constructor(public cachedAddress: Address, public accountId?: number) { }

connect(provider: SyncProvider) {
this.provider = provider;
Expand Down Expand Up @@ -208,16 +208,6 @@ export abstract class AbstractWallet {

// Transfer part

abstract getTransfer(transfer: {
to: Address;
token: TokenLike;
amount: BigNumberish;
fee: BigNumberish;
nonce: number;
validFrom: number;
validUntil: number;
}): Promise<Transfer>;

abstract signSyncTransfer(transfer: {
to: Address;
token: TokenLike;
Expand All @@ -240,16 +230,6 @@ export abstract class AbstractWallet {

// ChangePubKey part

abstract getChangePubKey(changePubKey: {
feeToken: TokenLike;
fee: BigNumberish;
nonce: number;
ethAuthData?: ChangePubKeyOnchain | ChangePubKeyECDSA | ChangePubKeyCREATE2;
ethSignature?: string;
validFrom: number;
validUntil: number;
}): Promise<ChangePubKey>;

abstract signSetSigningKey(changePubKey: {
feeToken: TokenLike;
fee: BigNumberish;
Expand All @@ -271,16 +251,6 @@ export abstract class AbstractWallet {

// Withdraw part

abstract getWithdrawFromSyncToEthereum(withdraw: {
ethAddress: string;
token: TokenLike;
amount: BigNumberish;
fee: BigNumberish;
nonce: number;
validFrom: number;
validUntil: number;
}): Promise<Withdraw>;

abstract signWithdrawFromSyncToEthereum(withdraw: {
ethAddress: string;
token: TokenLike;
Expand All @@ -304,15 +274,6 @@ export abstract class AbstractWallet {

// Forced exit part

abstract getForcedExit(forcedExit: {
target: Address;
token: TokenLike;
fee: BigNumberish;
nonce: number;
validFrom?: number;
validUntil?: number;
}): Promise<ForcedExit>;

abstract signSyncForcedExit(forcedExit: {
target: Address;
token: TokenLike;
Expand Down Expand Up @@ -356,14 +317,6 @@ export abstract class AbstractWallet {

abstract signOrder(order: Order): Promise<Order>;

abstract getSwap(swap: {
orders: [Order, Order];
feeToken: number;
amounts: [BigNumberish, BigNumberish];
nonce: number;
fee: BigNumberish;
}): Promise<Swap>;

abstract signSyncSwap(swap: {
orders: [Order, Order];
feeToken: number;
Expand All @@ -382,14 +335,6 @@ export abstract class AbstractWallet {

// Mint NFT part

abstract getMintNFT(mintNFT: {
recipient: string;
contentHash: string;
feeToken: TokenLike;
fee: BigNumberish;
nonce: number;
}): Promise<MintNFT>;

abstract signMintNFT(mintNFT: {
recipient: string;
contentHash: string;
Expand All @@ -408,16 +353,6 @@ export abstract class AbstractWallet {

// Withdraw NFT part

abstract getWithdrawNFT(withdrawNFT: {
to: string;
token: TokenLike;
feeToken: TokenLike;
fee: BigNumberish;
nonce: number;
validFrom: number;
validUntil: number;
}): Promise<WithdrawNFT>;

abstract signWithdrawNFT(withdrawNFT: {
to: string;
token: number;
Expand Down
Loading

0 comments on commit 22fcca3

Please sign in to comment.