Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Types and acceslists #315

Merged
merged 17 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3,957 changes: 2,527 additions & 1,430 deletions dist/quais.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/quais.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/quais.min.js

Large diffs are not rendered by default.

3,957 changes: 2,527 additions & 1,430 deletions dist/quais.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/quais.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/quais.umd.min.js

Large diffs are not rendered by default.

11 changes: 2 additions & 9 deletions dist/wordlists-extra.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/wordlists-extra.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/content/classes/ContractTransactionResponse.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ when waited on.
| `gasLimit` | `readonly` | `bigint` | The maximum units of gas this transaction can consume. If execution exceeds this, the entries transaction is<br />reverted and the sender is charged for the full amount, despite not state changes being made. | `QuaiTransactionResponse.gasLimit` |
| `hash` | `readonly` | `string` | The transaction hash. | `QuaiTransactionResponse.hash` |
| `index` | `readonly` | `bigint` | The index within the block that this transaction resides at. | `QuaiTransactionResponse.index` |
| `maxFeePerGas` | `readonly` | `null` \| `bigint` | The maximum fee (per unit of gas) to allow this transaction to charge the sender. | `QuaiTransactionResponse.maxFeePerGas` |
| `maxPriorityFeePerGas` | `readonly` | `null` \| `bigint` | The maximum priority fee (per unit of gas) to allow a validator to charge the sender. This is inclusive of the<br />QuaiTransactionResponse.maxFeePerGas \| **maxFeePerGas**. | `QuaiTransactionResponse.maxPriorityFeePerGas` |
| `gasPrice` | `readonly` | `null` \| `bigint` | The maximum fee (per unit of gas) to allow this transaction to charge the sender. | `QuaiTransactionResponse.gasPrice` |
| `minerTip` | `readonly` | `null` \| `bigint` | The maximum priority fee (per unit of gas) to allow a validator to charge the sender. This is inclusive of the<br />QuaiTransactionResponse.gasPrice \| **gasPrice**. | `QuaiTransactionResponse.minerTip` |
| `nonce` | `readonly` | `number` | The nonce, which is used to prevent replay attacks and offer a method to ensure transactions from a given sender<br />are explicitly ordered.<br /><br />When sending a transaction, this must be equal to the number of transactions ever sent by<br />[**from** ](/sdk/content/classes/ContractTransactionResponse). | `QuaiTransactionResponse.nonce` |
| `provider` | `readonly` | [`Provider`](/sdk/content/interfaces/Provider) | The provider this is connected to, which will influence how its methods will resolve its async inspection<br />methods. | `QuaiTransactionResponse.provider` |
| `signature` | `readonly` | [`Signature`](/sdk/content/classes/Signature) | The signature. | `QuaiTransactionResponse.signature` |
Expand Down
11 changes: 4 additions & 7 deletions docs/content/classes/FeeData.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,17 @@ A **FeeData** wraps all the fee-related values associated with the network.
```ts
new FeeData(
gasPrice?,
maxFeePerGas?,
maxPriorityFeePerGas?): FeeData
minerTip?): FeeData
```

Creates a new FeeData for `gasPrice`, `maxFeePerGas` and `maxPriorityFeePerGas`.
Creates a new FeeData for `gasPrice`, `gasPrice` and `minerTip`.

#### Parameters

| Parameter | Type | Description |
| :------ | :------ | :------ |
| `gasPrice`? | `null` \| `bigint` | The gas price. |
| `maxFeePerGas`? | `null` \| `bigint` | The maximum fee per gas. |
| `maxPriorityFeePerGas`? | `null` \| `bigint` | The maximum priority fee per gas. |
| `minerTip`? | `null` \| `bigint` | The maximum priority fee per gas. |

#### Returns

Expand All @@ -40,8 +38,7 @@ Creates a new FeeData for `gasPrice`, `maxFeePerGas` and `maxPriorityFeePerGas`.
| Property | Modifier | Type | Description |
| :------ | :------ | :------ | :------ |
| `gasPrice` | `readonly` | `null` \| `bigint` | The gas price for legacy networks. |
| `maxFeePerGas` | `readonly` | `null` \| `bigint` | The maximum fee to pay per gas.<br /><br />The base fee per gas is defined by the network and based on congestion, increasing the cost during times of heavy<br />load and lowering when less busy.<br /><br />The actual fee per gas will be the base fee for the block and the priority fee, up to the max fee per gas.<br /><br />This will be `null` on legacy networks (i.e. [pre-EIP-1559](https://eips.ethereum.org/EIPS/eip-1559)) |
| `maxPriorityFeePerGas` | `readonly` | `null` \| `bigint` | The additional amount to pay per gas to encourage a validator to include the transaction.<br /><br />The purpose of this is to compensate the validator for the adjusted risk for including a given transaction.<br /><br />This will be `null` on legacy networks (i.e. [pre-EIP-1559](https://eips.ethereum.org/EIPS/eip-1559)) |
| `minerTip` | `readonly` | `null` \| `bigint` | The additional amount to pay per gas to encourage a validator to include the transaction.<br /><br />The purpose of this is to compensate the validator for the adjusted risk for including a given transaction.<br /><br />This will be `null` on legacy networks (i.e. [pre-EIP-1559](https://eips.ethereum.org/EIPS/eip-1559)) |

## Methods

Expand Down
14 changes: 4 additions & 10 deletions docs/content/classes/QuaiTransaction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,6 @@ The gas limit.

***

### gasPrice

```ts
get gasPrice(): null | bigint
```

The gas price.

On legacy networks this defines the fee that will be paid. On EIP-1559 networks, this should be `null`.
Expand Down Expand Up @@ -224,10 +218,10 @@ True if the transaction is external.

***

### maxFeePerGas
### gasPrice

```ts
get maxFeePerGas(): null | bigint
get gasPrice(): null | bigint
```

The maximum total fee per unit of gas to pay. On legacy networks this should be `null`.
Expand All @@ -242,10 +236,10 @@ The maximum total fee per unit of gas to pay. On legacy networks this should be

***

### maxPriorityFeePerGas
### minerTip

```ts
get maxPriorityFeePerGas(): null | bigint
get minerTip(): null | bigint
```

The maximum priority fee per unit of gas to pay. On legacy networks this should be `null`.
Expand Down
5 changes: 2 additions & 3 deletions docs/content/interfaces/ContractDeployTransaction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ A deployment transaction for a contract.
| `data` | `string` | The transaction data. | `Omit.data` |
| `from` | `string` | The from address, if any. | `Omit.from` |
| `gasLimit?` | `bigint` | The maximum amount of gas to allow this transaction to consume. | `Omit.gasLimit` |
| `gasPrice?` | `bigint` | The gas price to use for legacy transactions or transactions on legacy networks.<br /><br />Most of the time the `max*FeePerGas` is preferred. | `Omit.gasPrice` |
| `maxFeePerGas?` | `bigint` | The [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) maximum total fee to pay per gas. The actual value used<br />is protocol enforced to be the block's base fee. | `Omit.maxFeePerGas` |
| `maxPriorityFeePerGas?` | `bigint` | The [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) maximum priority fee to pay per gas. | `Omit.maxPriorityFeePerGas` |
| `gasPrice?` | `bigint` | The [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) maximum total fee to pay per gas. The actual value used<br />is protocol enforced to be the block's base fee. | `Omit.gasPrice` |
| `minerTip?` | `bigint` | The [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) maximum priority fee to pay per gas. | `Omit.minerTip` |
| `nonce?` | `number` | The nonce of the transaction, used to prevent replay attacks. | `Omit.nonce` |
| `type?` | `number` | The transaction type. | `Omit.type` |
| `value?` | `bigint` | The transaction value (in wei). | `Omit.value` |
5 changes: 2 additions & 3 deletions docs/content/interfaces/ContractTransaction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ When populating a transaction this type is returned.
| `data` | `string` | The transaction data. | `QuaiPreparedTransactionRequest.data` | `QuaiPreparedTransactionRequest.data` |
| `from` | `string` | The from address, if any. | `QuaiPreparedTransactionRequest.from` | `QuaiPreparedTransactionRequest.from` |
| `gasLimit?` | `bigint` | The maximum amount of gas to allow this transaction to consume. | `QuaiPreparedTransactionRequest.gasLimit` | `QuaiPreparedTransactionRequest.gasLimit` |
| `gasPrice?` | `bigint` | The gas price to use for legacy transactions or transactions on legacy networks.<br /><br />Most of the time the `max*FeePerGas` is preferred. | `QuaiPreparedTransactionRequest.gasPrice` | `QuaiPreparedTransactionRequest.gasPrice` |
| `maxFeePerGas?` | `bigint` | The [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) maximum total fee to pay per gas. The actual value used<br />is protocol enforced to be the block's base fee. | `QuaiPreparedTransactionRequest.maxFeePerGas` | `QuaiPreparedTransactionRequest.maxFeePerGas` |
| `maxPriorityFeePerGas?` | `bigint` | The [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) maximum priority fee to pay per gas. | `QuaiPreparedTransactionRequest.maxPriorityFeePerGas` | `QuaiPreparedTransactionRequest.maxPriorityFeePerGas` |
| `gasPrice?` | `bigint` | The [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) maximum total fee to pay per gas. The actual value used<br />is protocol enforced to be the block's base fee. | `QuaiPreparedTransactionRequest.gasPrice` | `QuaiPreparedTransactionRequest.gasPrice` |
| `minerTip?` | `bigint` | The [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) maximum priority fee to pay per gas. | `QuaiPreparedTransactionRequest.minerTip` | `QuaiPreparedTransactionRequest.minerTip` |
| `nonce?` | `number` | The nonce of the transaction, used to prevent replay attacks. | `QuaiPreparedTransactionRequest.nonce` | `QuaiPreparedTransactionRequest.nonce` |
| `to` | `string` | The target address. | `QuaiPreparedTransactionRequest.to` | `QuaiPreparedTransactionRequest.to` |
| `type?` | `number` | The transaction type. | `QuaiPreparedTransactionRequest.type` | `QuaiPreparedTransactionRequest.type` |
Expand Down
2 changes: 1 addition & 1 deletion docs/content/type-aliases/PerformActionRequest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type PerformActionRequest:
"zone": Zone;
}
| {
"method": "getMaxPriorityFeePerGas";
"method": "getMinerTip";
"zone": Zone;
}
| {
Expand Down
4 changes: 2 additions & 2 deletions examples/signing/sign-verify-quai.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ async function main() {
const from = addressInfo1.address;
const txObj = new quais.QuaiTransaction(from);
txObj.gasLimit = BigInt(1000000);
(txObj.maxPriorityFeePerGas = BigInt(10000000000)),
(txObj.maxFeePerGas = BigInt(30000000000000)),
(txObj.minerTip = BigInt(10000000000)),
(txObj.gasPrice = BigInt(30000000000000)),
(txObj.to = '0x002F4783248e2D6FF1aa6482A8C0D7a76de3C329');
txObj.value = BigInt(4200000);

Expand Down
4 changes: 4 additions & 0 deletions examples/transactions/send-qi-tx.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ async function main() {
const provider = new quais.JsonRpcProvider(process.env.RPC_URL);

// Create wallet and connect to provider
console.log(process.env.RPC_URL)
const mnemonic = quais.Mnemonic.fromPhrase(process.env.MNEMONIC);
console.log(mnemonic)
const qiWallet = quais.QiHDWallet.fromMnemonic(mnemonic);
qiWallet.connect(provider);

Expand Down Expand Up @@ -54,7 +56,9 @@ async function main() {
txObj.txOutputs = txOutputs;

// Sign and send the tx
console.log('\nSending Qi Tx...')
const tx = await qiWallet.sendTransaction(txObj);
console.log('\nTx:', tx)

// Wait for tx to be mined
const txReceipt = await tx.wait();
Expand Down
4 changes: 2 additions & 2 deletions examples/transactions/send-quai-tx.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ async function main() {
* txObj.chainId = BigInt(9000);
* txObj.nonce = await provider.getTransactionCount(from, 'latest');
* txObj.gasLimit = BigInt(1000000);
* txObj.maxPriorityFeePerGas = BigInt(10000000000),
* txObj.maxFeePerGas = BigInt(30000000000000),
* txObj.minerTip = BigInt(10000000000),
* txObj.gasPrice = BigInt(30000000000000),
*/

// Sign and send the transaction
Expand Down
1 change: 1 addition & 0 deletions examples/wallets/qi-send.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ async function main() {

// Initialize Alice's wallet
console.log('Initializing Alice wallet...');
console.log('Scanning Cyprus1 zone...', quais.Zone.Cyprus1);
await aliceQiWallet.scan(quais.Zone.Cyprus1);
console.log('Alice wallet scan complete');

Expand Down
Loading
Loading