Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

CORE-1952 add v2 complete withdrawal #413

Merged
merged 28 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
393bec1
update OpenAPI generated API client code
kaihirota Dec 5, 2023
6d2fcda
add prepare withdrawal v2 workflow
kaihirota Dec 5, 2023
03aa93d
fix typo
kaihirota Dec 14, 2023
77f2585
update error message
kaihirota Feb 5, 2024
e189c16
rename vars
kaihirota Feb 5, 2024
d191afa
Merge branch 'main' into CORE-1942-create-withdrawal-v2
kaihirota Feb 22, 2024
1a5143e
Merge branch 'main' into CORE-1942-create-withdrawal-v2
kaihirota Feb 22, 2024
f568af7
Merge branch 'main' into CORE-1942-create-withdrawal-v2
kaihirota Feb 23, 2024
3f894e1
Merge branch 'main' into CORE-1942-create-withdrawal-v2
kaihirota Feb 25, 2024
bee2cba
update
kaihirota Feb 25, 2024
49530da
update
kaihirota Feb 25, 2024
f6494b9
fix bad refs
kaihirota Feb 25, 2024
2a1bb38
add stark v4 factory
kaihirota Feb 19, 2024
d557a51
rename core factory to stark v3
kaihirota Feb 19, 2024
6f7cb14
update
kaihirota Feb 19, 2024
5d9b69b
add v2 complete withdrawal
kaihirota Feb 5, 2024
3292610
update
kaihirota Feb 12, 2024
e796738
add v4 stark contract
kaihirota Feb 16, 2024
acb12b8
update
kaihirota Feb 19, 2024
38daa61
update examples
kaihirota Feb 19, 2024
4641e81
Merge branch 'main' into CORE-1952-add-v4-starkex-contract-bindings
kaihirota Feb 26, 2024
5fab131
update changelog and version
kaihirota Feb 26, 2024
13d0a14
Merge branch 'CORE-1952-add-v4-starkex-contract-bindings' into CORE-1…
kaihirota Feb 26, 2024
7b148cf
changelog
kaihirota Feb 26, 2024
7622f9f
update version and changelog
kaihirota Feb 26, 2024
b5a60d2
Merge branch 'main' into CORE-1952-add-v2-complete-withdrawal-flow
kaihirota Feb 26, 2024
74b40c2
Merge branch 'main' into CORE-1952-add-v2-complete-withdrawal-flow
kaihirota Feb 27, 2024
34d559f
update import
kaihirota Feb 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.7.0] - 2024-02-26

### Added

- `completeWithdrawal` has been updated to use V2 withdrawal logic for StarkEx V4 contract.

## [2.6.0] - 2024-02-26

### Added

- `prepareWithdrawal` has been updated to use V2 withdrawal logic for StarkEx V4 contract.
- Add StarkEx V4 contract bindings so that SDK can interact with the contract.

## [2.5.4] - 2024-02-20

### Added
Expand Down
5 changes: 1 addition & 4 deletions examples/completeErc20Withdrawal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ import { generateWalletConnection } from './libs/walletConnection';

const client = new ImmutableX(Config.SANDBOX);

const starkPublicKey = await walletConnection.starkSigner.getAddress();

const completeWithdrawalResponse = await client.completeWithdrawal(
walletConnection.ethSigner,
starkPublicKey,
walletConnection,
{
type: 'ERC20',
tokenAddress: '',
Expand Down
5 changes: 1 addition & 4 deletions examples/completeEthWithdrawal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ import { generateWalletConnection } from './libs/walletConnection';

const client = new ImmutableX(Config.SANDBOX);

const starkPublicKey = await walletConnection.starkSigner.getAddress();

const completeWithdrawalResponse = await client.completeWithdrawal(
walletConnection.ethSigner,
starkPublicKey,
walletConnection,
{
type: 'ETH',
},
Expand Down
5 changes: 1 addition & 4 deletions examples/completeNftWithdrawal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ import { generateWalletConnection } from './libs/walletConnection';

const client = new ImmutableX(Config.SANDBOX);

const starkPublicKey = await walletConnection.starkSigner.getAddress();

const completeWithdrawalResponse = await client.completeWithdrawal(
walletConnection.ethSigner,
starkPublicKey,
walletConnection,
{
type: 'ERC721',
tokenAddress: '',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@imtbl/core-sdk",
"version": "2.5.4",
"version": "2.7.0",
"description": "Immutable Core SDK",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
Expand Down
8 changes: 3 additions & 5 deletions src/ImmutableX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,19 +592,17 @@ export class ImmutableX {

/**
* Completes a Withdrawal
* @param ethSigner - the L1 signer
* @param starkPublicKey - the Signer address
* @param walletConnection - the pair of L1/L2 signers
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameter change necessary because completeWithdrawal needs stark signer in order to do registerEthAddress in StarkEx V4

https://github.com/immutable/imx-core-sdk/pull/423/files#diff-1ec0606bbd2c1c2767dfceb18d6dcade2beeedc6479166251fe7b86cca8d072b

* @param token - the token
* @returns a promise that resolves with the transaction
* @throws {@link index.IMXError}
*/
public completeWithdrawal(
ethSigner: EthSigner,
starkPublicKey: string,
walletConnection: WalletConnection,
token: AnyToken,
kaihirota marked this conversation as resolved.
Show resolved Hide resolved
) {
return this.workflows
.completeWithdrawal(ethSigner, starkPublicKey, token)
.completeWithdrawal(walletConnection, token)
.catch(err => {
throw formatError(err);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import type {
OnEvent,
} from "../common";

export interface CoreInterface extends utils.Interface {
export interface StarkV3Interface extends utils.Interface {
functions: {
"announceAvailabilityVerifierRemovalIntent(address)": FunctionFragment;
"announceVerifierRemovalIntent(address)": FunctionFragment;
Expand Down Expand Up @@ -864,12 +864,12 @@ export type LogWithdrawalPerformedEvent = TypedEvent<
export type LogWithdrawalPerformedEventFilter =
TypedEventFilter<LogWithdrawalPerformedEvent>;

export interface Core extends BaseContract {
export interface StarkV3 extends BaseContract {
connect(signerOrProvider: Signer | Provider | string): this;
attach(addressOrName: string): this;
deployed(): Promise<this>;

interface: CoreInterface;
interface: StarkV3Interface;

queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
Expand Down
Loading
Loading