Skip to content

Commit

Permalink
ci(changesets): versioning packages (#742)
Browse files Browse the repository at this point in the history
* ci(scripts): update docs

* ci(changesets): versioning packages

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and github-actions[bot] authored Feb 9, 2023
1 parent 1f79f79 commit 9e9e356
Show file tree
Hide file tree
Showing 129 changed files with 1,363 additions and 351 deletions.
2 changes: 0 additions & 2 deletions .changeset/beige-mangos-call.md

This file was deleted.

2 changes: 0 additions & 2 deletions .changeset/chilled-tools-play.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/famous-doors-refuse.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/giant-seals-play.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/lazy-trains-admire.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/olive-starfishes-brush.md

This file was deleted.

2 changes: 0 additions & 2 deletions .changeset/perfect-pots-sparkle.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/shy-moles-pay.md

This file was deleted.

2 changes: 0 additions & 2 deletions .changeset/tender-stingrays-press.md

This file was deleted.

2 changes: 0 additions & 2 deletions .changeset/three-dolphins-cheer.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/_data/versions.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# generated-file
fuels: 0.29.1
fuels: 0.30.0
fuel-core: 0.15.1
sway: 0.32.2
forc: 0.32.2
2 changes: 1 addition & 1 deletion docs/guide/abi-typegen/generate-contract-types-from-abi.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ yarn add fuels
#### Generate Types

```sh
yarn exec fuels typegen -i ./abis/*-abi.json -o ./types
yarn exec fuels -i ./abis/*-abi.json -o ./types
```

Note:
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/contracts/call-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Here we set call params alongside [transaction parameters](./transaction-paramet
})
.call<BN>();
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L259-L271)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L260-L272)

---

Expand Down Expand Up @@ -80,7 +80,7 @@ Here we set call params as part of a [Multicall](./multicalls.md)
})
.call<[BN, BN, BN]>();
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L276-L296)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L277-L297)

---

2 changes: 1 addition & 1 deletion docs/guide/contracts/calling-external-contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Your contract method might be calling other contracts. To do so, you must feed t

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#L132-L143)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L133-L144)

---

2 changes: 1 addition & 1 deletion docs/guide/contracts/cost-estimation.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Below are examples that show how to get the estimated transaction cost from sing
]);
const transactionCost = await invocationScope.getTransactionCost();
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L358-L368)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L359-L369)

---

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/contracts/logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ You can access the logged values in TypeScript by using the `logs` property in t
expect(logs[2]).toEqual('Fuel');
expect([logs[3], logs[4], logs[5]]).toEqual([1, 2, 3]);
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/coverage-contract.test.ts#L495-L502)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/coverage-contract.test.ts#L497-L504)

---

8 changes: 4 additions & 4 deletions docs/guide/contracts/multicalls.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ At a basic level, you can call the same contract function multiple times in the
.call();
expect(JSON.stringify(results)).toEqual(JSON.stringify([bn(1337), bn(1337)]));
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L179-L186)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L180-L187)

---

Expand All @@ -40,7 +40,7 @@ You can execute multiple contract calls to distinct contracts within a single tr
contract.functions.call_external_foo(1336, otherContract.id),
];
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L147-L156)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L148-L157)

---

Expand All @@ -53,7 +53,7 @@ Next, you provide the prepared calls to the `multiCall` method and optionally co
```typescript
const scope = contract.multiCall(calls).addContracts([otherContract]);
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L158-L160)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L159-L161)

---

Expand All @@ -69,7 +69,7 @@ To get the output values of the bundled calls, invoke of `call()` or `simulate()
const { value: results } = await scope.call();
expect(JSON.stringify(results)).toEqual(JSON.stringify([bn(1337), bn(1338)]));
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L172-L175)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L173-L176)

---

2 changes: 1 addition & 1 deletion docs/guide/contracts/read-only-calls.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You can do this with the SDK. Instead of `.call()`ing the method, use `.get()`:
const { value } = await contract.functions.echo_b256(contract.id.toB256()).get();
expect(value).toEqual(contract.id.toB256());
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L677-L681)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L699-L703)

---

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/contracts/transaction-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ You can configure these parameters by using the optional `TxParams` and passing
})
.call();
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L116-L123)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/contract.test.ts#L117-L124)

---

Expand Down
10 changes: 5 additions & 5 deletions docs/guide/cookbook/deposit-and-withdraw.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ Next, let's setup a [`Wallet`](../wallets/index.md) and seed it with some coins.
const wallet = Wallet.fromPrivateKey(PRIVATE_KEY, provider);
await seedTestWallet(wallet, [{ assetId: NativeAssetId, amount: bn(100_000) }]);
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L438-L443)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L459-L464)

---

Expand Down Expand Up @@ -167,7 +167,7 @@ Let's now deploy both the contracts and set them up.
const liquidityPoolContractID = liquidityPoolContract.id;
await liquidityPoolContract.functions.set_base_token(tokenContractID).call();
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L445-L464)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L466-L485)

---

Expand All @@ -192,7 +192,7 @@ Next, let's mint some tokens and transfer them to our wallet.
})
.call();
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L467-L483)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L488-L504)

---

Expand All @@ -213,7 +213,7 @@ Now, let's deposit some tokens into the liquidity pool contract. Since we have t
})
.call();
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L486-L498)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L507-L519)

---

Expand All @@ -235,7 +235,7 @@ As a final demonstration, let's use all our liquidity asset balance to withdraw
})
.call();
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L505-L518)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L526-L539)

---

24 changes: 24 additions & 0 deletions docs/guide/messages/getting-a-message-proof.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: "Getting A Message Proof"
parent: "Messages"
grand_parent: "Guide"
---

[info]: this file is autogenerated
# Getting a Message Proof

A message proof is a cryptographic proof that a message was included in a block. You can use the `getMessageProof` method to retrieve a message proof for a given transaction ID and message ID.


```typescript
const result = await tx.wait();
const messageOutReceipt = <TransactionResultMessageOutReceipt>result.receipts[0];
const messageProof = await provider.getMessageProof(
TRANSACTION_ID,
messageOutReceipt.messageID
);
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/wallet/src/transfer.test.ts#L169-L176)

---

28 changes: 28 additions & 0 deletions docs/guide/messages/getting-all-resources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: "Getting All Resources"
parent: "Messages"
grand_parent: "Guide"
---

[info]: this file is autogenerated
# Getting All Resources

You can use the `getResourcesToSpend` method to retrieve a list of all the resources (coins + assets) that can be spent by a given address.


```typescript
const walletLocked = Wallet.fromAddress(
'0x09c0b2d1a486c439a87bcba6b46a7a1a23f3897cc83a94521a96da5c23bc58db'
);
const resourcesToSpend = await walletLocked.getResourcesToSpend([
{
amount: bn(2),
assetId: '0x0101010101010101010101010101010101010101010101010101010101010101',
},
]);
expect(resourcesToSpend[0].amount.gt(2)).toBeTruthy();
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/wallet/src/wallet-locked.test.ts#L38-L49)

---

57 changes: 57 additions & 0 deletions docs/guide/messages/getting-messages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: "Getting Messages"
parent: "Messages"
grand_parent: "Guide"
---

[info]: this file is autogenerated
# Getting Messages

You can use the `getMessages` method to retrieve a list of messages from the blockchain.


```typescript
const WALLET_A = Wallet.fromPrivateKey(
'0x1ff16505df75735a5bcf4cb4cf839903120c181dd9be6781b82cda23543bd242',
provider
);
const WALLET_B = Wallet.fromPrivateKey(
'0x30bb0bc68f5d2ec3b523cee5a65503031b40679d9c72280cd8088c2cfbc34e38',
provider
);

const EXPECTED_MESSAGES_A: Message[] = [
{
sender: WALLET_B.address,
recipient: WALLET_A.address,
nonce: bn(1),
amount: bn(1),
data: arrayify(
'0x00000000000000080000000000000007000000000000000600000000000000050000000000000004'
),
daHeight: bn(0),
fuelBlockSpend: bn(0),
},
];
const EXPECTED_MESSAGES_B: Message[] = [
{
sender: WALLET_A.address,
recipient: WALLET_B.address,
nonce: bn('1017517292834129547'),
amount: bn('12704439083013451934'),
data: arrayify('0x0000000000000007'),
daHeight: bn('3684546456337077810'),
fuelBlockSpend: bn(0),
},
];

const aMessages = await WALLET_A.getMessages();
const bMessages = await WALLET_B.getMessages();

expect(aMessages).toStrictEqual(EXPECTED_MESSAGES_A);
expect(bMessages).toStrictEqual(EXPECTED_MESSAGES_B);
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/coverage-contract.test.ts#L369-L409)

---

36 changes: 36 additions & 0 deletions docs/guide/messages/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: "Messages"
parent: "Guide"
has_children: true
has_toc: false
nav_order: 9
---

[info]: this file is autogenerated


# Messages

A message is an object that contains some data that when broadcasted to the network, can change the state of the blockchain. This can include sending tokens, creating a new account, or deploying a smart contract. Messages are signed by a sender and broadcasted to the network. This message is then verified and included in a block.

This is the general structure of a `Message` object:


```typescript
/**
* A Fuel message
*/
export type Message = {
sender: AbstractAddress;
recipient: AbstractAddress;
nonce: BN;
amount: BN;
data: BytesLike;
daHeight: BN;
fuelBlockSpend: BN;
};
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/providers/src/message.ts#L5-L18)

---

29 changes: 28 additions & 1 deletion docs/guide/predicates/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,38 @@ Similar to contracts, once you've written a predicate in Sway and compiled it wi
expect(predicate.address).toBeTruthy();
expect(predicate.bytes).toEqual(arrayify(testPredicateTrue));
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L338-L344)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L339-L345)

---


The created `predicate` instance has two fields. The predicate `bytes (byte code)` and the predicate `address`. This address is generated from the byte code and is the same as the `P2SH` address used in Bitcoin. Users can seamlessly send assets to the predicate address as they do for any other address on the chain. To spend the predicate funds, the user has to provide the original `byte code` of the predicate together with the `predicate data`. The `predicate data` will be used when executing the `byte code`, and if the predicate is validated successfully, the funds will be accessible.

In the next section, we show how to interact with a predicate and explore an example where specific signatures are needed to spend the predicate funds.

## Calling a predicate with a `main` function that takes arguments

Suppose your Sway predicate `main` function is written using the arguments passed to the `main` function like so:


```rust
predicate;

struct Validation {
has_account: bool,
total_complete: u64,
}

fn main(received: Validation) -> bool {
let expected_has_account: bool = true;
let expected_total_complete: u64 = 100;

received.has_account == expected_has_account && received.total_complete == expected_total_complete
}
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/test-projects/predicate-main-args-struct/src/main.sw#L1-L15)

---


You can still create a `Predicate` in the same way as above, but you can pass in a `JsonAbi` using the JSON generated from `forc`.
Loading

0 comments on commit 9e9e356

Please sign in to comment.