Skip to content

Commit

Permalink
Merge pull request #3014 from superhero-com/fix/multisig
Browse files Browse the repository at this point in the history
fix: calculate auth tx hash in Ceres
  • Loading branch information
CedrikNikita authored May 5, 2024
2 parents 301c5ff + 4bbbf25 commit c3ebf54
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [2.2.5](https://github.com/Superhero-com/superhero-wallet/compare/v2.2.4...v2.2.5) (2024-05-04)


### Bug Fixes

* calculate auth tx hash in Ceres ([59c578e](https://github.com/Superhero-com/superhero-wallet/commit/59c578eb3dd5f23bd113b090e2ab3ff7369ab784))

### [2.2.4](https://github.com/Superhero-com/superhero-wallet/compare/v2.2.3...v2.2.4) (2024-04-22)


Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.superhero.cordova"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 20204
versionName "2.2.4"
versionCode 20205
versionName "2.2.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
4 changes: 2 additions & 2 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.2.4;
MARKETING_VERSION = 2.2.5;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = com.superhero.cordova;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -390,7 +390,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.2.4;
MARKETING_VERSION = 2.2.5;
PRODUCT_BUNDLE_IDENTIFIER = com.superhero.cordova;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "superhero-wallet",
"version": "2.2.4",
"version": "2.2.5",
"description": "Superhero wallet",
"author": "Superhero",
"license": "MIT",
Expand Down
12 changes: 6 additions & 6 deletions src/composables/multisigTransactions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {
AccountGeneralized,
hash,
unpackTx,
decode,
Tag,
encode,
Encoded,
Expand Down Expand Up @@ -35,9 +33,12 @@ interface InternalOptions {

const MULTISIG_TRANSACTION_EXPIRATION_HEIGHT = 480;

// TODO: calculate gas price based on node demand
const GA_META_PARAMS = { fee: 1e14, gasPrice: 1e9 };

export function useMultisigTransactions() {
const { aeActiveNetworkPredefinedSettings } = useAeNetworkSettings();
const { nodeNetworkId, getDryAeSdk, getAeSdk } = useAeSdk();
const { getDryAeSdk, getAeSdk } = useAeSdk();
const { fetchCurrentTopBlockHeight } = useTopHeaderData();

async function buildSpendTx(
Expand Down Expand Up @@ -107,9 +108,7 @@ export function useMultisigTransactions() {
const [aeSdk, topBlockHeight] = await Promise.all([getAeSdk(), fetchCurrentTopBlockHeight()]);
const expirationHeight = topBlockHeight + MULTISIG_TRANSACTION_EXPIRATION_HEIGHT;

const spendTxHash = new Uint8Array(hash(
Buffer.concat([Buffer.from(nodeNetworkId.value!), decode(spendTx)]),
));
const spendTxHash = await aeSdk.buildAuthTxHash(spendTx, GA_META_PARAMS);

const gaContractRpc = await aeSdk.initializeContract({
aci: SimpleGAMultiSigAci,
Expand Down Expand Up @@ -166,6 +165,7 @@ export function useMultisigTransactions() {
return dryAeSdk.sendTransaction(spendTx, {
authData: {
callData: gaContractRpc._calldata.encode(gaContractRpc._name, 'authorize', [nonce]),
...GA_META_PARAMS,
},
onAccount: new AccountGeneralized(accountId),
});
Expand Down

0 comments on commit c3ebf54

Please sign in to comment.