Skip to content

Commit

Permalink
feat: adding WASM integration for @fuels/vm-asm (#1080)
Browse files Browse the repository at this point in the history
  • Loading branch information
arboleya authored Jul 25, 2023
1 parent b2937d7 commit def4c96
Show file tree
Hide file tree
Showing 39 changed files with 90 additions and 1,841 deletions.
8 changes: 8 additions & 0 deletions .changeset/big-onions-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"demo-nextjs": patch
"demo-react-cra": patch
"demo-react-vite": patch
"@fuel-ts/wallet": patch
---

Adding WASM integration for `@fuels/vm-asm`
5 changes: 3 additions & 2 deletions apps/demo-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
"pretest": "pnpm original:build"
},
"dependencies": {
"@fuels/vm-asm": "0.34.1",
"@types/node": "18.15.3",
"@types/react": "18.2.9",
"@types/react-dom": "18.2.4",
"@types/react": "18.2.9",
"fuels": "workspace:*",
"next": "13.4.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "18.2.0",
"typescript": "^4.8.4"
}
}
2 changes: 2 additions & 0 deletions apps/demo-nextjs/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as asm from "@fuels/vm-asm";
import { BaseAssetId, decrypt, encrypt } from "fuels";
import Image from "next/image";

Expand All @@ -7,6 +8,7 @@ export default function Home() {
const { log } = console;

log("Hello Fuels", BaseAssetId, encrypt, decrypt);
log("Hello ASM", asm);

return (
<main className={styles.main}>
Expand Down
5 changes: 3 additions & 2 deletions apps/demo-react-cra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
"version": "0.1.2",
"private": true,
"dependencies": {
"@fuels/vm-asm": "0.34.1",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.34",
"@types/react": "^18.2.9",
"@types/react-dom": "^18.2.4",
"@types/react": "^18.2.9",
"eslint-config-react-app": "^7.0.1",
"fuels": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"react": "^18.2.0",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"
},
Expand Down
2 changes: 2 additions & 0 deletions apps/demo-react-cra/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import React from "react";
import logo from "./logo.svg";
import "./App.css";
import * as asm from "@fuels/vm-asm";
import { BaseAssetId, encrypt, decrypt } from "fuels";

function App() {
const { log } = console;

log("Hello Fuels", BaseAssetId, encrypt, decrypt);
log("Hello ASM", asm);

return (
<div className="App">
Expand Down
5 changes: 3 additions & 2 deletions apps/demo-react-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
"pretest": "pnpm original:build"
},
"dependencies": {
"@fuels/vm-asm": "0.34.1",
"fuels": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.37",
Expand Down
2 changes: 2 additions & 0 deletions apps/demo-react-vite/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import reactLogo from "./assets/react.svg";
import viteLogo from "/vite.svg";
import "./App.css";

import * as asm from "@fuels/vm-asm";
import { BaseAssetId, encrypt, decrypt } from "fuels";

function App() {
Expand All @@ -11,6 +12,7 @@ function App() {
const { log } = console;

log("Hello Fuels", BaseAssetId, encrypt, decrypt);
log("Hello ASM", asm);

return (
<>
Expand Down
1 change: 0 additions & 1 deletion internal/check-imports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"@fuel-ts/abi-coder": "workspace:*",
"@fuel-ts/abi-typegen": "workspace:*",
"@fuel-ts/address": "workspace:*",
"@fuel-ts/asm": "workspace:*",
"@fuel-ts/contract": "workspace:*",
"@fuel-ts/hasher": "workspace:*",
"@fuel-ts/hdwallet": "workspace:*",
Expand Down
2 changes: 0 additions & 2 deletions internal/check-imports/src/imports.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as abiCoder from '@fuel-ts/abi-coder';
import * as abiTypegen from '@fuel-ts/abi-typegen';
import * as address from '@fuel-ts/address';
import * as asm from '@fuel-ts/asm';
import * as contract from '@fuel-ts/contract';
// forc-bin
// fuels-gauge
Expand Down Expand Up @@ -32,7 +31,6 @@ log([
abiCoder,
abiTypegen,
address,
asm,
contract,
fuels,
hasher,
Expand Down
6 changes: 0 additions & 6 deletions internal/check-imports/src/references.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { runCliAction } from '@fuel-ts/abi-typegen/cli';
import { runTypegen } from '@fuel-ts/abi-typegen/runTypegen';
import { Address } from '@fuel-ts/address';
import { BaseAssetId } from '@fuel-ts/address/configs';
import { VM_REGISTER_COUNT } from '@fuel-ts/asm';
import { ContractFactory } from '@fuel-ts/contract';
import { hashTransaction, hashMessage } from '@fuel-ts/hasher';
import { HDWallet } from '@fuel-ts/hdwallet';
Expand Down Expand Up @@ -55,11 +54,6 @@ log(Address);
log(BaseAssetId);
log(Address.fromPublicKey('asdfasdf'));

/**
* asm
*/
log(VM_REGISTER_COUNT); // pnpm add add @fuel-ts/asm

/**
* contract
*/
Expand Down
7 changes: 3 additions & 4 deletions packages/abi-coder/test/interface.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { BigNumber } from '@ethersproject/bignumber';
import { concat } from '@ethersproject/bytes';
import { off } from 'process';

import { NumberCoder, VecCoder, WORD_SIZE, Interface } from '../src';
import { NumberCoder, WORD_SIZE, Interface } from '../src';
import type { JsonAbiConfigurable } from '../src/json-abi';

import { exhaustiveExamplesAbi } from './fixtures/exhaustive-examples-abi';
Expand Down Expand Up @@ -562,7 +561,7 @@ describe('Abi interface', () => {
vec: [3, 9, 6, 4],
},
],
encodedValue: (input?: any, offset: number = 0) => {
encodedValue: (input?: any, _offset: number = 0) => {
// eslint-disable-next-line no-param-reassign
input = input[0];
const enumCaseOne = [0, 0, 0, 0, 0, 0, 0, 1];
Expand Down Expand Up @@ -626,7 +625,7 @@ describe('Abi interface', () => {
},
])(
'$title: $value',
({ fn, title, value, encodedValue, decodedTransformer, skipDecoding, offset }) => {
({ fn, title: _, value, encodedValue, decodedTransformer, skipDecoding, offset }) => {
const encoded = Array.isArray(value)
? fn.encodeArguments(value, offset)
: fn.encodeArguments([value], offset);
Expand Down
39 changes: 0 additions & 39 deletions packages/asm/CHANGELOG.md

This file was deleted.

Loading

0 comments on commit def4c96

Please sign in to comment.