Skip to content

Commit

Permalink
ci(changesets): versioning packages (#686)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Dec 20, 2022
1 parent d0eb1c7 commit f04a075
Show file tree
Hide file tree
Showing 95 changed files with 551 additions and 646 deletions.
5 changes: 0 additions & 5 deletions .changeset/angry-mails-heal.md

This file was deleted.

6 changes: 0 additions & 6 deletions .changeset/famous-eyes-guess.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changeset/neat-needles-switch.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/red-rockets-glare.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/violet-planes-chew.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/young-panthers-argue.md

This file was deleted.

8 changes: 4 additions & 4 deletions docs/_data/versions.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# generated-file
fuels: 0.26.0
fuel-core: 0.14.0
sway: 0.31.3
forc: 0.31.3
fuels: 0.27.0
fuel-core: 0.15.1
sway: 0.32.2
forc: 0.32.2
5 changes: 2 additions & 3 deletions docs/guide/local-docs.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Local Docs

There are two parts to the fuels-ts repository documentation

## Part One: Typedoc
[typedoc](https://typedoc.org/) does the work of gathering all types, functions, classes, etc. from all of our source code. It will read through the `packages` folder and collect all that information and convert it into a markdown file, modifying the contents of [`docs/packages`](https://github.com/FuelLabs/fuels-ts/tree/master/docs/packages).
[typedoc](https://typedoc.org/) gathers all types, functions, classes, etc., from our source code. It will read through the `packages` folder, collect all that information, and convert it into a markdown file, modifying the contents of [`docs/packages`](https://github.com/FuelLabs/fuels-ts/tree/master/docs/packages).


Furthermore, I've enhanced typedoc to also build out the [Guide documentation](https://fuellabs.github.io/fuels-ts/guide/) with a custom plugin called `typedoc-plugin-guide-builder` that's in our [repo here](https://github.com/FuelLabs/fuels-ts/tree/master/scripts/typedoc-plugin-guide-builder) (We should move this to a standalone plugin later on). This portion of the typedoc process takes source files from [`docs/_guide`](https://github.com/FuelLabs/fuels-ts/tree/master/docs/_guide), runs them through the plugins and renders code snippets pulled from source code.

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/predicates/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ 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#L324-L330)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L331-L337)

---

Expand Down
14 changes: 7 additions & 7 deletions docs/guide/predicates/send-and-spend-funds-from-predicates.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Let's use the SDK to interact with the predicate. First, let's create three wall

const receiver = Wallet.generate({ provider });
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L334-L348)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L341-L355)

---

Expand All @@ -82,7 +82,7 @@ Next, let's add some coins to the wallets.
await TestUtils.seedWallet(wallet2, [{ assetId: NativeAssetId, amount: bn(20_000) }]);
await TestUtils.seedWallet(wallet3, [{ assetId: NativeAssetId, amount: bn(30_000) }]);
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L350-L355)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L357-L362)

---

Expand All @@ -109,7 +109,7 @@ Now we can load the predicate binary, and prepare some transaction variables.
const assetId = NativeAssetId;
const initialPredicateBalance = await provider.getBalance(predicate.address, assetId);
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L357-L375)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L364-L382)

---

Expand All @@ -125,7 +125,7 @@ After the predicate address is generated we can send funds to it. Note that we a
// assert that predicate address now has the expected amount to predicate
expect(bn(predicateBalance)).toEqual(initialPredicateBalance.add(amountToPredicate));
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L377-L384)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L384-L391)

---

Expand All @@ -142,7 +142,7 @@ Alternatively, you can use `Wallet.submitPredicate` to setup a `Predicate` and u
initialPredicateBalance.add(amountToPredicate).add(200)
);
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L386-L394)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L393-L401)

---

Expand All @@ -158,7 +158,7 @@ To spend the funds that are now locked in this example's Predicate, we have to p

const signatures = [signature1, signature2, signature3];
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L396-L403)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L403-L410)

---

Expand All @@ -180,7 +180,7 @@ After generating the signatures, we can send a transaction to spend the predicat
// assert that predicate funds now belong to the receiver
expect(bn(receiverBalance)).toEqual(bn(updatedPredicateBalance));
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L405-L418)
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L412-L425)

---

48 changes: 3 additions & 45 deletions docs/guide/providers/connecting-to-an-external-node.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,10 @@
---
title: "Connecting To An External Node"
parent: "Providers"
grand_parent: "Guide"
nav_order: 2
---

[info]: this file is autogenerated

[nav_order: 2]

# Connecting to the Testnet or an external node

We can interact with the `Testnet` node by using the following example.


```typescript
import { Provider, WalletUnlocked } from 'fuels';
const provider = new Provider('node-beta-2.fuel.network');
// Setup a private key
const PRIVATE_KEY = 'a1447cd75accc6b71a976fd3401a1f6ce318d27ba660b0315ee6ac347bf39568';

// Create the wallet, passing provider
const wallet: WalletUnlocked = Wallet.fromPrivateKey(PRIVATE_KEY, provider);

const signer = new Signer(PRIVATE_KEY);
// validate address
expect(wallet.address).toEqual(signer.address);
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L236-L250)

---

[@code:typescript](./packages/fuel-gauge/src/doc-examples.test.ts#typedoc:provider-testnet)

In the code example, we connected a new provider to the Testnet node and created a new wallet from a private key.

Expand All @@ -45,21 +20,4 @@ In the code example, we connected a new provider to the Testnet node and created
If you want to connect to another node just change the url or IP and port. For example, to connect to a local node that was created with `fuel-core` you can use:


```typescript
import { Provider, WalletUnlocked } from 'fuels';
const localProvider = new Provider('http://127.0.0.1:4000/graphql');
// Setup a private key
const PRIVATE_KEY = 'a1447cd75accc6b71a976fd3401a1f6ce318d27ba660b0315ee6ac347bf39568';

// Create the wallet, passing provider
const wallet: WalletUnlocked = Wallet.fromPrivateKey(PRIVATE_KEY, localProvider);

const signer = new Signer(PRIVATE_KEY);
// validate address
expect(wallet.address).toEqual(signer.address);
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L254-L266)

---

[@code:typescript](./packages/fuel-gauge/src/doc-examples.test.ts#typedoc:provider-local)
10 changes: 1 addition & 9 deletions docs/guide/providers/connection.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
---
title: "Connection"
parent: "Providers"
grand_parent: "Guide"
nav_order: 1
---

[info]: this file is autogenerated

[nav_order: 1]

# Connecting to a Fuel node

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

[info]: this file is autogenerated

[nav_order: 3]

# Providers

Expand Down
77 changes: 4 additions & 73 deletions docs/guide/providers/querying-the-chain.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
---
title: "Querying The Chain"
parent: "Providers"
grand_parent: "Guide"
nav_order: 3
---

[info]: this file is autogenerated

[nav_order: 3]

# Interacting with the blockchain

Expand All @@ -28,77 +20,16 @@ See [connecting](./connecting.md)

This method returns all coins (of an optional given asset ID) from a wallet, including spent ones.


```typescript
import { Provider, TestUtils } from 'fuels';
const provider = new Provider('http://127.0.0.1:4000/graphql');
const assetIdA = '0x0101010101010101010101010101010101010101010101010101010101010101';

const wallet = await TestUtils.generateTestWallet(provider, [
[42, NativeAssetId],
[100, assetIdA],
]);

// get single coin
const coin = await wallet.getCoins(NativeAssetId);

// get all coins
const coins = await wallet.getCoins();

expect(coin.length).toEqual(1);
expect(coin).toEqual([
expect.objectContaining({
assetId: NativeAssetId,
amount: bn(42),
}),
]);
expect(coins).toEqual([
expect.objectContaining({
assetId: NativeAssetId,
amount: bn(42),
}),
expect.objectContaining({
assetId: assetIdA,
amount: bn(100),
}),
]);
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L270-L303)

---

[@code:typescript](./packages/fuel-gauge/src/doc-examples.test.ts#typedoc:wallet-query)

## Get spendable resources from an address

The last argument says how much you want to spend. This method returns only spendable, i.e., unspent coins (of a given asset ID). If you ask for more spendable than the amount of unspent coins you have, it returns an error.


```typescript
const spendableResources = await wallet.getResourcesToSpend([
{ amount: 32, assetId: NativeAssetId, max: 42 },
{ amount: 50, assetId: assetIdA },
]);
expect(spendableResources[0].amount).toEqual(bn(42));
expect(spendableResources[1].amount).toEqual(bn(100));
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L313-L320)

---

[@code:typescript](./packages/fuel-gauge/src/doc-examples.test.ts#typedoc:wallet-get-spendable-resources)

## Get balances from an address

Get all the spendable balances of all assets for an address. This is different from getting the coins because we only return the numbers (the sum of UTXOs coins amount for each asset id) and not the UTXOs coins themselves.


```typescript
const walletBalances = await wallet.getBalances();
expect(walletBalances).toEqual([
{ assetId: NativeAssetId, amount: bn(42) },
{ assetId: assetIdA, amount: bn(100) },
]);
```
###### [see code in context](https://github.com/FuelLabs/fuels-ts/blob/master/packages/fuel-gauge/src/doc-examples.test.ts#L305-L311)

---

[@code:typescript](./packages/fuel-gauge/src/doc-examples.test.ts#typedoc:wallet-get-balances)
11 changes: 1 addition & 10 deletions docs/guide/testing/index.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
---
title: "Testing"
parent: "Guide"
has_children: true
has_toc: false
nav_order: 7
---

[info]: this file is autogenerated

[nav_order: 7]

# Testing

Expand Down
Loading

0 comments on commit f04a075

Please sign in to comment.