Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
fix: deploy contracts with multiple args (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
DoubleOTheven authored Jul 11, 2023
1 parent 98be817 commit f93af9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/useink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"React",
"hooks"
],
"version": "1.12.0",
"version": "1.13.0",
"main": "dist/index.js",
"module": "dist/index.mjs",
"description": "A React hooks library for ink! contracts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ export function useDeployer<T>(chainId?: ChainId): Deploy<T> {
return;
}

const messageParams = constructorMessage.toU8a(
toMessageParams(chainApi.api, abiParams, constructorParams || {}),
const messageParams = toMessageParams(
chainApi.api,
abiParams,
constructorParams || {},
);

const caller =
Expand All @@ -134,7 +136,7 @@ export function useDeployer<T>(chainId?: ChainId): Deploy<T> {
gasLimitMax,
storageDepositMax,
codeHash ? { Existing: codeHash } : { Upload: abi.info.source.wasm },
messageParams,
constructorMessage.toU8a(messageParams),
options?.salt ? encodeSalt(options?.salt) : '',
];

Expand Down Expand Up @@ -173,9 +175,10 @@ export function useDeployer<T>(chainId?: ChainId): Deploy<T> {
storageDepositLimit: res.storageDeposit.asCharge || null,
...toDeployOptions(options),
};

tx =
constructorMessage.args.length > 0
? method?.(methodOptions, messageParams)
? method?.(methodOptions, ...messageParams)
: method?.(methodOptions);
} catch (e: unknown) {
setError(e?.toString());
Expand Down

0 comments on commit f93af9a

Please sign in to comment.