diff --git a/src/signer.ts b/src/signer.ts index 9a938245..863c1c29 100644 --- a/src/signer.ts +++ b/src/signer.ts @@ -15,6 +15,7 @@ import { SignMode } from 'cosmjs-types/cosmos/tx/signing/v1beta1/signing' import { Any } from 'cosmjs-types/google/protobuf/any' import { Coin } from 'cosmjs-types/cosmos/base/v1beta1/coin' import Long from 'long' +import { fromString } from 'uint8arrays' export function calculateDidFee(gasLimit: number, gasPrice: string | GasPrice): DidStdFee { return calculateFee(gasLimit, gasPrice) @@ -204,7 +205,7 @@ export class CheqdSigningStargateClient extends SigningStargateClient { return { verificationMethodId: signInput.verificationMethodId, // TODO: We can't rely on `payload.verificationMethod` here because `CreateResourceTx` doesn't have it - signature: base64ToBytes((await (await this.getDidSigner(signInput.verificationMethodId, payload.verificationMethod))(hexToBytes(signInput.privateKeyHex))(signBytes)) as string) + signature: fromString((await (await this.getDidSigner(signInput.verificationMethodId, payload.verificationMethod))(hexToBytes(signInput.privateKeyHex))(signBytes)) as string) } })) @@ -219,7 +220,7 @@ export class CheqdSigningStargateClient extends SigningStargateClient { return { verificationMethodId: signInput.verificationMethodId, // TODO: We can't rely on `payload.verificationMethod` here because `CreateResourceTx` doesn't have it - signature: base64ToBytes((await (await this.getDidSigner(signInput.verificationMethodId, payload.verificationMethod))(hexToBytes(signInput.privateKeyHex))(signBytes)) as string) + signature: fromString((await (await this.getDidSigner(signInput.verificationMethodId, payload.verificationMethod))(hexToBytes(signInput.privateKeyHex))(signBytes)) as string) } })) @@ -234,7 +235,7 @@ export class CheqdSigningStargateClient extends SigningStargateClient { return { verificationMethodId: signInput.verificationMethodId, // TODO: We can't rely on `payload.verificationMethod` here because `CreateResourceTx` doesn't have it - signature: base64ToBytes((await (await this.getDidSigner(signInput.verificationMethodId, verificationMethod))(hexToBytes(signInput.privateKeyHex))(signBytes)) as string) + signature: fromString((await (await this.getDidSigner(signInput.verificationMethodId, verificationMethod))(hexToBytes(signInput.privateKeyHex))(signBytes)) as string) } })) @@ -267,7 +268,7 @@ export class CheqdSigningStargateClient extends SigningStargateClient { signInfos.push({ verificationMethodId: signInput.verificationMethodId, - signature: base64ToBytes(signature) + signature: fromString(signature) }); } diff --git a/tests/modules/did.test.ts b/tests/modules/did.test.ts index 13e7dc02..b6020f56 100644 --- a/tests/modules/did.test.ts +++ b/tests/modules/did.test.ts @@ -41,7 +41,7 @@ describe('DIDModule', () => { amount: [ { denom: 'ncheq', - amount: '5000000' + amount: '5000000000' } ], gas: '100000', @@ -79,7 +79,7 @@ describe('DIDModule', () => { amount: [ { denom: 'ncheq', - amount: '5000000' + amount: '5000000000' } ], gas: '100000', @@ -120,7 +120,7 @@ describe('DIDModule', () => { amount: [ { denom: 'ncheq', - amount: '5000000' + amount: '5000000000' } ], gas: '100000', diff --git a/tests/modules/resource.test.ts b/tests/modules/resource.test.ts index 4d607444..e98da3c6 100644 --- a/tests/modules/resource.test.ts +++ b/tests/modules/resource.test.ts @@ -48,7 +48,7 @@ describe('ResourceModule', () => { amount: [ { denom: 'ncheq', - amount: '50000000' + amount: '2500000000' } ], gas: '1000000',