-
Notifications
You must be signed in to change notification settings - Fork 273
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 #395 from argentlabs/develop
- Loading branch information
Showing
94 changed files
with
95,195 additions
and
50,489 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Run Tests | ||
on: | ||
push: | ||
branches: [develop] | ||
pull_request: | ||
branches: [develop] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
devnet: | ||
image: shardlabs/starknet-devnet | ||
ports: | ||
- 5000:5000 | ||
|
||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: "14" | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Run tests | ||
run: yarn --cwd packages/extension 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Migration from 2.x to 3.x | ||
|
||
## Major breaking changes | ||
|
||
### in Argent X: | ||
|
||
- Accounts are now upgradable, i.e. every account is now a proxy account forwarding to a given implentation | ||
- Support for new account interface in Cairo (multicall, fees, ...) | ||
- New backup file structure | ||
- Small changes in `starknet` object injected in the browser (see below) | ||
|
||
### in starknet.js | ||
|
||
- Redefinition of [Signer](https://github.com/0xs34n/starknet.js/blob/develop/src/signer/interface.ts) and [Account](https://github.com/0xs34n/starknet.js/blob/develop/src/account/interface.ts) objects | ||
- Support for new account interface in Cairo (multicall, fees, ...) | ||
|
||
## What does it mean as an Argent X user? | ||
|
||
As a new user, you have nothing to do, enjoy Argent X 3.0.0! | ||
|
||
As a user of Argent X 2.x, after upgrading to version 3.0.0, your extension will start as a fresh new install where you'll have to create new accounts. If you want to migrate assets from your old accounts (which you don't have to), here is the procedure: | ||
|
||
1. After installing Argent X 3.0.0 and opening the extension, you'll have a one-time the opportunity to download your old backup file, do it! | ||
|
||
2. Continue the onboarding flow and a fresh new account will be created, take note of the address of this new account, you'll transfer all your assets from your old accounts there. | ||
|
||
3. Download the zip file of Argent X 2.2.3, it's available [here](https://github.com/argentlabs/argent-x/releases/download/v2.3.0/argent-extension-v2.3.0.zip) on our github repository. Install it manually into your Chrome by: | ||
|
||
- Going to [chrome://extensions/](chrome://extensions/) | ||
- Enabling `Developer mode` (upper right) | ||
- Clicking `Load unpacked` and chosing the previous zip file | ||
|
||
Now you should have two versions of Argent X installed simultaneously! | ||
|
||
4. Disable Argent X 3.0.0 by switching off the toggle in the lower right corner of the Argent X panel in the Chrome extensions page. | ||
|
||
5. Open the extension v2.2.3 and restore from your backup file, the one you downloaded in step 1. Now you can transfer all your tokens to your new address, the one you copied at step 2. For ERC721 assets, you'll have to do it in [Voyager](https://voyager.online/), the StarkNet block explorer, by connecting your wallet and transferring manually. | ||
|
||
## What does it mean as a StarkNet dapp developer? | ||
|
||
The `starknet` object (returned by `get-starknet`) will now expose an `account` object instead of a `signer` object. This `account` object implements the [AccountInterface](https://github.com/0xs34n/starknet.js/blob/develop/src/account/interface.ts), specifically it exposes the methods `execute()` and `signMessage()`: | ||
|
||
```typescript | ||
public abstract execute(transactions: Call | Call[], abis?: Abi[], transactionsDetail?: InvocationsDetails): Promise<AddTransactionResponse>; | ||
|
||
public abstract signMessage(typedData: TypedData): Promise<Signature>; | ||
``` | ||
|
||
where `Call` is defined by: | ||
|
||
```typescript | ||
interface Call { | ||
contractAddress: string; | ||
entrypoint: string; | ||
calldata?: BigNumberish[]; | ||
} | ||
``` | ||
|
||
All transactions triggered by an account should go through the `execute` method. It supports multi calls, which means multiple contract interactions can be submitted in a single transactions (like bundling an ERC20 `approve` followed by a call to a contract). The `entrypoint` property is the actual name of the method (i.e. `mint`, `transfer`, ...) instead of its selector. If ABIs are provided, the signature request will show an explicit definition of the transaction. | ||
|
||
## Backwards compatibility | ||
|
||
The `Signer` object is backwards compatible but the `Provider` is not, so dapps using the `Provider` injected by the extension should update their code as soon as possible. | ||
|
||
## Code migration from starknet.js v2 to v3 | ||
|
||
On the left: starknet.js v2, on the right: starknet.js v3 | ||
|
||
![Migration changes](/docs/v3-code-migration.png) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,258 @@ | ||
[ | ||
{ | ||
"members": [ | ||
{ | ||
"name": "low", | ||
"offset": 0, | ||
"type": "felt" | ||
}, | ||
{ | ||
"name": "high", | ||
"offset": 1, | ||
"type": "felt" | ||
} | ||
], | ||
"name": "Uint256", | ||
"size": 2, | ||
"type": "struct" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"name": "name", | ||
"type": "felt" | ||
}, | ||
{ | ||
"name": "symbol", | ||
"type": "felt" | ||
}, | ||
{ | ||
"name": "recipient", | ||
"type": "felt" | ||
} | ||
], | ||
"name": "constructor", | ||
"outputs": [], | ||
"type": "constructor" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "name", | ||
"outputs": [ | ||
{ | ||
"name": "name", | ||
"type": "felt" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "symbol", | ||
"outputs": [ | ||
{ | ||
"name": "symbol", | ||
"type": "felt" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "totalSupply", | ||
"outputs": [ | ||
{ | ||
"name": "totalSupply", | ||
"type": "Uint256" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "decimals", | ||
"outputs": [ | ||
{ | ||
"name": "decimals", | ||
"type": "felt" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"name": "account", | ||
"type": "felt" | ||
} | ||
], | ||
"name": "balanceOf", | ||
"outputs": [ | ||
{ | ||
"name": "balance", | ||
"type": "Uint256" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"name": "owner", | ||
"type": "felt" | ||
}, | ||
{ | ||
"name": "spender", | ||
"type": "felt" | ||
} | ||
], | ||
"name": "allowance", | ||
"outputs": [ | ||
{ | ||
"name": "remaining", | ||
"type": "Uint256" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"name": "recipient", | ||
"type": "felt" | ||
}, | ||
{ | ||
"name": "amount", | ||
"type": "Uint256" | ||
} | ||
], | ||
"name": "transfer", | ||
"outputs": [ | ||
{ | ||
"name": "success", | ||
"type": "felt" | ||
} | ||
], | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"name": "sender", | ||
"type": "felt" | ||
}, | ||
{ | ||
"name": "recipient", | ||
"type": "felt" | ||
}, | ||
{ | ||
"name": "amount", | ||
"type": "Uint256" | ||
} | ||
], | ||
"name": "transferFrom", | ||
"outputs": [ | ||
{ | ||
"name": "success", | ||
"type": "felt" | ||
} | ||
], | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"name": "spender", | ||
"type": "felt" | ||
}, | ||
{ | ||
"name": "amount", | ||
"type": "Uint256" | ||
} | ||
], | ||
"name": "approve", | ||
"outputs": [ | ||
{ | ||
"name": "success", | ||
"type": "felt" | ||
} | ||
], | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"name": "spender", | ||
"type": "felt" | ||
}, | ||
{ | ||
"name": "added_value", | ||
"type": "Uint256" | ||
} | ||
], | ||
"name": "increaseAllowance", | ||
"outputs": [ | ||
{ | ||
"name": "success", | ||
"type": "felt" | ||
} | ||
], | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"name": "spender", | ||
"type": "felt" | ||
}, | ||
{ | ||
"name": "subtracted_value", | ||
"type": "Uint256" | ||
} | ||
], | ||
"name": "decreaseAllowance", | ||
"outputs": [ | ||
{ | ||
"name": "success", | ||
"type": "felt" | ||
} | ||
], | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"name": "recipient", | ||
"type": "felt" | ||
}, | ||
{ | ||
"name": "amount", | ||
"type": "Uint256" | ||
} | ||
], | ||
"name": "mint", | ||
"outputs": [], | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"name": "user", | ||
"type": "felt" | ||
}, | ||
{ | ||
"name": "amount", | ||
"type": "Uint256" | ||
} | ||
], | ||
"name": "burn", | ||
"outputs": [], | ||
"type": "function" | ||
} | ||
] |
Oops, something went wrong.