Skip to content

Commit

Permalink
Merge pull request #395 from argentlabs/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
janek26 authored Mar 11, 2022
2 parents 11085af + 1695929 commit a5b8a45
Show file tree
Hide file tree
Showing 94 changed files with 95,195 additions and 50,489 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ jobs:
with:
github-token: ${{ secrets.PAT }}
script: |-
github.pulls.createReview({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
pull_number: context.payload.pull_request.number,
event: 'APPROVE'
})
github.pulls.merge({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
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
2 changes: 1 addition & 1 deletion Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ We automated some parts of the release process to make things easier. This file

1. Run dependabot updates (Insights > Dependency graph > Last checked ... > Check now (for every package)
2. Go through the QA process in Notion
3. [THIS IS BROKEN] Run `npx lerna version` to create tag and push it automatically
3. Run `npx lerna version` to create tag and push it automatically
4. Wait for pipeline to create release containing the extension zip, and if the automatic npm publish failed, do it manually (ask Gerald)
5. Edit release to contain a bit more than just the auto generated notes and maybe a proper title
6. Submit to Chrome Web Store (ask Julien)
69 changes: 69 additions & 0 deletions docs/Upgrade_v3.md
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)
Binary file added 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.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": [
"packages/*"
],
"version": "2.3.0",
"version": "3.0.0",
"npmClient": "yarn",
"useWorkspaces": true
}
258 changes: 258 additions & 0 deletions packages/dapp/abi/ERC20.json
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"
}
]
Loading

0 comments on commit a5b8a45

Please sign in to comment.