Skip to content

Commit

Permalink
ci(changesets): versioning packages (#793)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Feb 21, 2023
1 parent 66c200a commit df99ac4
Show file tree
Hide file tree
Showing 208 changed files with 8,070 additions and 5,005 deletions.
2 changes: 0 additions & 2 deletions .changeset/angry-items-sing.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/chilly-masks-vanish.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/clever-chefs-shop.md

This file was deleted.

2 changes: 0 additions & 2 deletions .changeset/giant-moose-explain.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/hip-maps-collect.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/honest-ways-learn.md

This file was deleted.

10 changes: 0 additions & 10 deletions .changeset/nine-bottles-jog.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/pretty-falcons-sleep.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/shiny-experts-flow.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/wise-squids-relate.md

This file was deleted.

4 changes: 2 additions & 2 deletions docs/_data/versions.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# generated-file
fuels: 0.31.0
fuel-core: 0.17.1
fuels: 0.32.0
fuel-core: 0.17.2
sway: 0.32.2
forc: 0.32.2
10 changes: 1 addition & 9 deletions docs/guide/abi-typegen/generate-contract-types-from-abi.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
---
title: "Generate Contract Types From Abi"
parent: "Abi Typegen"
grand_parent: "Guide"
nav_order: 0
---

[info]: this file is autogenerated

[nav_order: 0]

# Generate Contract Types from ABI

Expand Down
11 changes: 1 addition & 10 deletions docs/guide/abi-typegen/index.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
---
title: "Abi Typegen"
parent: "Guide"
has_children: true
has_toc: false
nav_order: 1
---

[info]: this file is autogenerated

[nav_order: 1]

# ABI Typegen

Expand Down
10 changes: 1 addition & 9 deletions docs/guide/abi-typegen/using-generated-types.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
---
title: "Using Generated Types"
parent: "Abi Typegen"
grand_parent: "Guide"
nav_order: 1
---

[info]: this file is autogenerated

[nav_order: 1]

# Using Generated Types

Expand Down
70 changes: 4 additions & 66 deletions docs/guide/contracts/call-parameters.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
---
title: "Call Parameters"
parent: "Contracts"
grand_parent: "Guide"
nav_order: 6
---

[info]: this file is autogenerated

[nav_order: 6]

# Call parameters

Expand All @@ -19,68 +11,14 @@ Call parameters are:
You can use these to forward coins to a contract. You can configure these parameters by creating an instance of `CallParams` and passing it to a chain method called `callParams`.

At a basic level we can invoke the `callParams` method as part of the transaction flow to set these params:

```typescript
const { value } = await contract.functions
.return_context_amount()
.callParams({
forward: [1_000_000, NativeAssetId],
})
.call();
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/call-test-contract.test.ts#L176-L183)

---

[@code:typescript](./packages/fuel-gauge/src/call-test-contract.test.ts#typedoc:Contract-call-params)

Here we set call params alongside [transaction parameters](./transaction-parameters.md):

```typescript
const { value } = await contract.functions
.return_context_amount()
.callParams({
forward: [200, AltToken],
gasLimit: 1000000,
})
.txParams({
gasPrice: 1,
gasLimit: 2000000,
})
.call<BN>();
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L260-L272)

---

[@code:typescript](./packages/fuel-gauge/src/contract.test.ts#typedoc:Contract-call-params-with-tx-params)

The `forward` parameter defines the limit for the actual contract call as opposed to the gas limit for the whole transaction. This means that it is constrained by the transaction limit. If it is set to an amount greater than the available gas, all available gas will be forwarded.

## Multicall with multiple call parameters

Here we set call params as part of a [Multicall](./multicalls.md)

```typescript
const contract = await setupContract();

const { value } = await contract
.multiCall([
contract.functions.return_context_amount().callParams({
forward: [100, NativeAssetId],
}),
contract.functions.return_context_amount().callParams({
forward: [200, AltToken],
}),
contract.functions.return_context_asset().callParams({
forward: [0, AltToken],
}),
])
.txParams({
gasPrice: 1,
gasLimit: 2000000,
})
.call<[BN, BN, BN]>();
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L277-L297)

---

[@code:typescript](./packages/fuel-gauge/src/contract.test.ts#typedoc:Contract-call-params-with-multicall)
28 changes: 2 additions & 26 deletions docs/guide/contracts/calling-external-contracts.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,7 @@
---
title: "Calling External Contracts"
parent: "Contracts"
grand_parent: "Guide"
nav_order: 7
---

[info]: this file is autogenerated

[nav_order: 7]

# Calling external contracts

Your contract method might be calling other contracts. To do so, you must feed the external contract IDs that your contract depends on to the method you're calling.


```typescript
const contract = await setupContract();
const otherContract = await setupContract({
cache: false,
});

const scope = contract.functions.call_external_foo(1336, otherContract.id);

const { value: results } = await scope.call();

expect(results.toHex()).toEqual(toHex(1338));
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L133-L144)

---

[@code:typescript](./packages/fuel-gauge/src/contract.test.ts#typedoc:Contract-call-others)
10 changes: 1 addition & 9 deletions docs/guide/contracts/calls-with-different-wallets.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
---
title: "Calls With Different Wallets"
parent: "Contracts"
grand_parent: "Guide"
nav_order: 8
---

[info]: this file is autogenerated

[nav_order: 8]

# Calls with different Wallets or Providers

Expand Down
27 changes: 2 additions & 25 deletions docs/guide/contracts/cost-estimation.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
---
title: "Cost Estimation"
parent: "Contracts"
grand_parent: "Guide"
nav_order: 4
---

[info]: this file is autogenerated

[nav_order: 4]

# Estimating contract call cost

Expand All @@ -23,21 +15,6 @@ type TransactionCost = {

Below are examples that show how to get the estimated transaction cost from single and multi call transactions.


```typescript
const invocationScope = contract.multiCall([
contract.functions.return_context_amount().callParams({
forward: [100, NativeAssetId],
}),
contract.functions.return_context_amount().callParams({
forward: [200, AltToken],
}),
]);
const transactionCost = await invocationScope.getTransactionCost();
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L359-L369)

---

[@code:typescript](./packages/fuel-gauge/src/contract.test.ts#typedoc:Contract-cost)

The transaction cost estimation can be used to set the gas limit for an actual call, or to show the user the estimated cost.
38 changes: 2 additions & 36 deletions docs/guide/contracts/deploying-contracts.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
---
title: "Deploying Contracts"
parent: "Contracts"
grand_parent: "Guide"
nav_order: 12
---

[info]: this file is autogenerated

[nav_order: 12]

# Deploying contracts

Expand All @@ -22,33 +14,7 @@ Below is how you can deploy your contracts using the SDK. For more details about

If you are only interested in a single instance of your contract, then use `deploy`


```typescript
import { Provider, ContractFactory } from 'fuels';
import { generateTestWallet } from '@fuel-ts/wallet/test-utils';
// basic setup
const provider = new Provider('http://127.0.0.1:4000/graphql');
const wallet = await generateTestWallet(provider, [[5_000_000, NativeAssetId]]);

// load the byteCode of the contract, generated from Sway source
const byteCode = readFileSync(
join(__dirname, '../test-projects/storage-test-contract/out/debug/storage-test.bin')
);

// load the JSON abi of the contract, generated from Sway source
const abi = JSON.parse(
readFileSync(
join(__dirname, '../test-projects/storage-test-contract/out/debug/storage-test-abi.json')
).toString()
);

// send byteCode and ABI to ContractFactory to load
const factory = new ContractFactory(byteCode, abi, wallet);
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract-factory.test.ts#L10-L31)

---

[@code:typescript](./packages/fuel-gauge/src/contract-factory.test.ts#typedoc:contract-setup)

You can then use the contract methods very simply:

Expand Down
32 changes: 3 additions & 29 deletions docs/guide/contracts/index.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
---
title: "Contracts"
parent: "Guide"
has_children: true
has_toc: false
nav_order: 4
---

[info]: this file is autogenerated

[nav_order: 4]

# Calling contracts

Expand All @@ -20,26 +11,9 @@ Once you've deployed your contract, as seen in the previous sections, you'll lik

Here's an example. Suppose your Sway contract has two ABI methods called `echo_str_8(str[8])` and `echo_u8(u8)`. Once you've deployed the contract, you can call the methods like this:

[@code:typescript](./packages/fuel-gauge/src/coverage-contract.test.ts#typedoc:String-size8)

```typescript
const { value } = await contractInstance.functions.echo_str_8('fuel-sdk').call();

expect(value).toBe('fuel-sdk');
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/coverage-contract.test.ts#L99-L103)

---



```typescript
const { value } = await contractInstance.functions.echo_u8(3).call();
expect(value).toBe(3);
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/coverage-contract.test.ts#L46-L49)

---

[@code:typescript](./packages/fuel-gauge/src/coverage-contract.test.ts#typedoc:U8)

The examples above uses all the default configurations and performs a simple contract call.

Expand Down
Loading

0 comments on commit df99ac4

Please sign in to comment.