Compare commits

...
Author SHA1 Message Date
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
6d635dc266 Version Packages (#7891)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-08-20 10:24:39 -07:00
gregandGitHub 1083316ef6 [SDK] Feature: prepareCreateToken returns prepared transaction (#7872) 2025-08-20 10:06:41 -07:00
9 changed files with 56 additions and 5 deletions
+7
View File
@@ -1,5 +1,12 @@
# @thirdweb-dev/nebula
## 0.2.37
### Patch Changes
- Updated dependencies [[`1083316`](https://github.com/thirdweb-dev/js/commit/1083316ef681c3f6ca4138acd00b1e945c5156d5)]:
- thirdweb@5.105.37
## 0.2.36
### Patch Changes
+1 -1
View File
@@ -57,5 +57,5 @@
"type": "module",
"types": "./dist/types/exports/thirdweb.d.ts",
"typings": "./dist/types/exports/thirdweb.d.ts",
"version": "0.2.36"
"version": "0.2.37"
}
+6
View File
@@ -1,5 +1,11 @@
# thirdweb
## 5.105.37
### Patch Changes
- [#7872](https://github.com/thirdweb-dev/js/pull/7872) [`1083316`](https://github.com/thirdweb-dev/js/commit/1083316ef681c3f6ca4138acd00b1e945c5156d5) Thanks [@gregfromstl](https://github.com/gregfromstl)! - Update createToken to return a prepared transaction
## 5.105.36
### Patch Changes
+1 -1
View File
@@ -417,5 +417,5 @@
}
},
"typings": "./dist/types/exports/thirdweb.d.ts",
"version": "5.105.36"
"version": "5.105.37"
}
+1 -1
View File
@@ -6,7 +6,7 @@ export {
DEFAULT_DEVELOPER_ADDRESS,
DEFAULT_DEVELOPER_REWARD_BPS,
} from "../tokens/constants.js";
export { createToken } from "../tokens/create-token.js";
export { createToken, prepareCreateToken } from "../tokens/create-token.js";
export { distributeToken } from "../tokens/distribute-token.js";
export {
getDeployedContractFactory,
@@ -62,3 +62,39 @@ export async function createToken(options: CreateTokenOptions) {
return decodedEvent[0]?.args.asset;
}
export async function prepareCreateToken(options: CreateTokenOptions) {
const { client, params, account, launchConfig } = options;
const creator = params.owner || account.address;
const encodedInitData = await encodeInitParams({
client,
creator,
params,
});
const salt: Hex = generateSalt(options.salt || bytesToHex(randomBytes(31)));
const entrypoint = await getDeployedEntrypointERC20(options);
let hookData: Hex = "0x";
let contractId = padHex(toHex("ERC20Asset"), { size: 32 });
if (launchConfig?.kind === "pool") {
hookData = encodePoolConfig(launchConfig.config);
contractId = padHex(toHex("ERC20Asset_Pool"), { size: 32 });
}
const transaction = createById({
contract: entrypoint,
contractId,
params: {
data: encodedInitData,
hookData,
developer: options.developerAddress || DEFAULT_DEVELOPER_ADDRESS,
salt,
},
creator,
});
return transaction;
}
@@ -12,7 +12,7 @@ import {
import type { CreateTokenOptions } from "./types.js";
export async function predictAddress(options: CreateTokenOptions) {
const { client, account, params, launchConfig } = options;
const { client, params, launchConfig, account } = options;
const creator = params.owner || account.address;
const encodedInitData = await encodeInitParams({
+2
View File
@@ -1,5 +1,7 @@
# @thirdweb-dev/wagmi-adapter
## 0.2.134
## 0.2.133
## 0.2.132
+1 -1
View File
@@ -55,5 +55,5 @@
"type": "module",
"types": "./dist/types/exports/thirdweb.d.ts",
"typings": "./dist/types/exports/thirdweb.d.ts",
"version": "0.2.133"
"version": "0.2.134"
}