Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .changes/added/988.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
New ID function exports to TypeScript WASM target.
13 changes: 6 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -327,22 +327,21 @@ jobs:
uses: actions/setup-node@v3
with:
cache: "pnpm"
node-version: 18.14.1
node-version: 22.22.0
node-version-file: ".npm/package.json"
cache-dependency-path: ".npm/pnpm-lock.yaml"
registry-url: 'https://registry.npmjs.org'

# Ensure latest NPM is installed to support OIDC publishing
- name: Update npm
run: npm install -g npm@11

- name: Build and Test packages
run: |
pnpm -C .npm install
pnpm -C .npm pack:all

- name: Ensure NPM access
run: npm whoami
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_VM }}

- name: Publish
run: pnpm -C .npm publish -r --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_VM }}
NPM_CONFIG_PROVENANCE: "true"
4 changes: 4 additions & 0 deletions .npm/.scripts/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
"main": "dist/node/index.cjs",
"types": "dist/node/index.d.ts",
"browser": "dist/web/index.mjs",
"repository": {
"type": "git",
"url": "git+https://github.com/FuelLabs/fuel-vm.git"
},
"files": [
"dist"
],
Expand Down
29 changes: 28 additions & 1 deletion fuel-tx/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,10 @@ pub mod typescript {
string::String,
vec::Vec,
};
use fuel_types::Bytes32;
use fuel_types::{
Bytes32,
ChainId,
};

#[derive(Debug, Clone, Eq, Hash, PartialEq, serde::Serialize, serde::Deserialize)]
#[wasm_bindgen]
Expand Down Expand Up @@ -1209,6 +1212,18 @@ pub mod typescript {
.map_err(|e| js_sys::Error::new(&format!("{:?}", e)))
}

#[wasm_bindgen(js_name = id)]
pub fn typescript_id(&self, chain_id: &ChainId) -> Bytes32 {
use crate::UniqueIdentifier;
self.0.id(chain_id)
}

#[wasm_bindgen(js_name = cachedId)]
pub fn typescript_cached_id(&self) -> Option<Bytes32> {
use crate::UniqueIdentifier;
self.0.cached_id()
}

#[wasm_bindgen]
pub fn script(
gas_limit: Word,
Expand Down Expand Up @@ -1368,6 +1383,18 @@ pub mod typescript {
.map_err(|e| js_sys::Error::new(&format!("{:?}", e)))?;
Ok(Self(Box::new(res)))
}

#[wasm_bindgen(js_name = id)]
pub fn typescript_id(&self, chain_id: &ChainId) -> Bytes32 {
use crate::UniqueIdentifier;
self.0.id(chain_id)
}

#[wasm_bindgen(js_name = cachedId)]
pub fn typescript_cached_id(&self) -> Option<Bytes32> {
use crate::UniqueIdentifier;
self.0.cached_id()
}
}
};
}
Expand Down
Loading