Skip to content

Commit

Permalink
Merge branch 'master' into st/refactor/make-transaction-request-prote…
Browse files Browse the repository at this point in the history
…cted-on-base-invocation-scope
  • Loading branch information
Torres-ssf committed Sep 27, 2023
2 parents 78dd0b4 + 4f21279 commit 182e9ff
Show file tree
Hide file tree
Showing 82 changed files with 316 additions and 78 deletions.
File renamed without changes.
5 changes: 0 additions & 5 deletions .changeset/shaggy-sheep-suffer.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changeset/silly-paws-leave.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/twelve-apes-kneel.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/twenty-eagles-lick.md

This file was deleted.

2 changes: 2 additions & 0 deletions apps/demo-nextjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# demo-nextjs

## 0.1.20

## 0.1.19

## 0.1.18
Expand Down
2 changes: 1 addition & 1 deletion apps/demo-nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "demo-nextjs",
"version": "0.1.19",
"version": "0.1.20",
"private": true,
"scripts": {
"original:dev": "next dev",
Expand Down
2 changes: 2 additions & 0 deletions apps/demo-nodejs-esm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@
## null

## null

## null
2 changes: 2 additions & 0 deletions apps/demo-react-cra/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# demo-react-cra

## 0.1.20

## 0.1.19

## 0.1.18
Expand Down
2 changes: 1 addition & 1 deletion apps/demo-react-cra/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "demo-react-cra",
"version": "0.1.19",
"version": "0.1.20",
"private": true,
"dependencies": {
"@fuels/vm-asm": "0.36.1",
Expand Down
2 changes: 2 additions & 0 deletions apps/demo-react-vite/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# demo-react-vite

## 0.0.20

## 0.0.19

## 0.0.18
Expand Down
2 changes: 1 addition & 1 deletion apps/demo-react-vite/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "demo-react-vite",
"private": true,
"version": "0.0.19",
"version": "0.0.20",
"type": "module",
"scripts": {
"original:dev": "vite",
Expand Down
2 changes: 2 additions & 0 deletions apps/demo-typegen/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@
## null

## null

## null
2 changes: 2 additions & 0 deletions apps/docs-snippets/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @fuel-ts/docs-snippets

## 0.60.0

## 0.59.0

## 0.58.0
Expand Down
2 changes: 1 addition & 1 deletion apps/docs-snippets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fuel-ts/docs-snippets",
"version": "0.59.0",
"version": "0.60.0",
"description": "",
"private": true,
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions apps/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @fuel-ts/docs

## 0.43.2

## 0.43.1

## 0.43.0
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "docs",
"version": "0.43.1",
"version": "0.43.2",
"description": "",
"scripts": {
"dev": "nodemon --config nodemon.config.json -x 'pnpm run docs && vitepress dev'",
Expand Down
2 changes: 2 additions & 0 deletions internal/check-imports/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@
## null

## null

## null
6 changes: 6 additions & 0 deletions packages/abi-coder/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 0.60.0

### Minor Changes

- Add support for Bytes and RawSlice, by [@camsjams](https://github.com/camsjams) (See [#1221](https://github.com/FuelLabs/fuels-ts/pull/1221))

## 0.59.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/abi-coder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fuel-ts/abi-coder",
"version": "0.59.0",
"version": "0.60.0",
"description": "",
"author": "Fuel Labs <[email protected]> (https://fuel.network/)",
"main": "dist/index.js",
Expand Down
12 changes: 12 additions & 0 deletions packages/abi-coder/src/coders/byte.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { FuelError, ErrorCode } from '@fuel-ts/errors';
import { expectToThrowFuelError } from '@fuel-ts/errors/test-utils';

import type { Uint8ArrayWithDynamicData } from '../utilities';

import { ByteCoder } from './byte';
Expand Down Expand Up @@ -31,6 +34,15 @@ describe('ByteCoder', () => {
expect(actual).toStrictEqual(expected);
});

it('should throw when value to encode is not array', async () => {
const coder = new ByteCoder();
const nonArrayInput = { ...[1] };
await expectToThrowFuelError(
() => coder.encode(nonArrayInput),
new FuelError(ErrorCode.ENCODE_ERROR, 'Expected array value.')
);
});

it('should decode a byte', () => {
const coder = new ByteCoder();
const input = new Uint8Array([
Expand Down
11 changes: 11 additions & 0 deletions packages/abi-coder/src/coders/raw-slice.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { FuelError, ErrorCode } from '@fuel-ts/errors';
import { expectToThrowFuelError } from '@fuel-ts/errors/test-utils';
import type { BN } from '@fuel-ts/math';

import type { Uint8ArrayWithDynamicData } from '../utilities';
Expand All @@ -19,6 +21,15 @@ describe('RawSliceCoder', () => {
expect(actual).toStrictEqual(expected);
});

it('should throw when value to encode is not array', async () => {
const coder = new RawSliceCoder();
const nonArrayInput = { ...[1] };
await expectToThrowFuelError(
() => coder.encode(nonArrayInput),
new FuelError(ErrorCode.ENCODE_ERROR, 'Expected array value.')
);
});

it('should decode a raw-slice', () => {
const coder = new RawSliceCoder();
const input = new Uint8Array([
Expand Down
2 changes: 2 additions & 0 deletions packages/abi-typegen/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @fuel-ts/abi-typegen

## 0.60.0

## 0.59.0

## 0.58.0
Expand Down
2 changes: 1 addition & 1 deletion packages/abi-typegen/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fuel-ts/abi-typegen",
"version": "0.59.0",
"version": "0.60.0",
"description": "Generates Typescript definitions from Sway ABI Json files",
"author": "Fuel Labs <[email protected]> (https://fuel.network/)",
"bin": {
Expand Down
2 changes: 2 additions & 0 deletions packages/address/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Change Log

## 0.60.0

## 0.59.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/address/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fuel-ts/address",
"version": "0.59.0",
"version": "0.60.0",
"description": "Utilities for encoding and decoding addresses",
"author": "Fuel Labs <[email protected]> (https://fuel.network/)",
"main": "dist/index.js",
Expand Down
6 changes: 6 additions & 0 deletions packages/contract/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 0.60.0

### Minor Changes

- purging constant MAX_GAS_PER_TX, by [@Torres-ssf](https://github.com/Torres-ssf) (See [#1272](https://github.com/FuelLabs/fuels-ts/pull/1272))

## 0.59.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/contract/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fuel-ts/contract",
"version": "0.59.0",
"version": "0.60.0",
"description": "",
"author": "Fuel Labs <[email protected]> (https://fuel.network/)",
"main": "dist/index.js",
Expand Down
2 changes: 2 additions & 0 deletions packages/crypto/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Change Log

## 0.60.0

## 0.59.0

## 0.58.0
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fuel-ts/crypto",
"version": "0.59.0",
"version": "0.60.0",
"description": "Utilities for encrypting and decrypting data",
"author": "Fuel Labs <[email protected]> (https://fuel.network/)",
"main": "dist/index.js",
Expand Down
6 changes: 6 additions & 0 deletions packages/errors/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @fuel-ts/errors

## 0.60.0

### Minor Changes

- purging constant MAX_GAS_PER_TX, by [@Torres-ssf](https://github.com/Torres-ssf) (See [#1272](https://github.com/FuelLabs/fuels-ts/pull/1272))

## 0.59.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/errors/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fuel-ts/errors",
"version": "0.59.0",
"version": "0.60.0",
"description": "Error class and error codes that the fuels-ts library throws",
"author": "Fuel Labs <[email protected]> (https://fuel.network/)",
"main": "dist/index.js",
Expand Down
2 changes: 2 additions & 0 deletions packages/forc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Change Log

## 0.60.0

## 0.59.0

## 0.58.0
Expand Down
2 changes: 1 addition & 1 deletion packages/forc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fuel-ts/forc",
"version": "0.59.0",
"version": "0.60.0",
"description": "NPM bin wrapper around Fuel `forc`",
"author": "Fuel Labs <[email protected]> (https://fuel.network/)",
"bin": {
Expand Down
2 changes: 2 additions & 0 deletions packages/fuel-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @fuel-ts/fuel-core

## 0.60.0

## 0.59.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/fuel-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fuel-ts/fuel-core",
"version": "0.59.0",
"version": "0.60.0",
"description": "NPM bin wrapper around `fuel-core`",
"author": "Fuel Labs <[email protected]> (https://fuel.network/)",
"bin": {
Expand Down
2 changes: 2 additions & 0 deletions packages/fuel-gauge/fixtures/forc-projects/Forc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ members = [
"predicate-vector-types",
"raw-slice",
"revert-error",
"script-bytes",
"script-main-args",
"script-main-return-struct",
"script-main-two-args",
"script-raw-slice",
"script-with-configurable",
"script-with-array",
"script-with-vector",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[project]
authors = ["FuelLabs"]
entry = "main.sw"
license = "Apache-2.0"
name = "script-bytes"

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
script;

use std::bytes::Bytes;

#[allow(dead_code)]
enum SomeEnum<T> {
First: bool,
Second: T,
}

struct Wrapper<T> {
inner: T,
inner_enum: SomeEnum<Bytes>,
}

fn expected_bytes() -> Bytes {
let mut bytes = Bytes::new();

bytes.push(40u8);
bytes.push(41u8);
bytes.push(42u8);

bytes
}

fn main(_arg: u64, wrapper: Wrapper<Vec<Bytes>>) {
if let SomeEnum::Second(enum_bytes) = wrapper.inner_enum {
require(enum_bytes == expected_bytes(), "wrapper.inner_enum didn't carry the expected bytes")
} else {
require(false, "enum was not of variant Second");
}

let inner_vec = wrapper.inner;
require(inner_vec.len() == 2, "Expected wrapper.inner vector to have 2 elements");
require(inner_vec.get(0).unwrap() == expected_bytes(), "wrapper.inner[0] didn't match expectation");
require(inner_vec.get(1).unwrap() == expected_bytes(), "wrapper.inner[1] didn't match expectation");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[project]
authors = ["FuelLabs"]
entry = "main.sw"
license = "Apache-2.0"
name = "script-raw-slice"

[dependencies]
Loading

0 comments on commit 182e9ff

Please sign in to comment.