diff --git a/packages/types/src/interfaces/integriteeWorker/definitions.ts b/packages/types/src/interfaces/integriteeWorker/definitions.ts index 308f34b..4a5855a 100644 --- a/packages/types/src/interfaces/integriteeWorker/definitions.ts +++ b/packages/types/src/interfaces/integriteeWorker/definitions.ts @@ -157,7 +157,7 @@ export default { unused_index_17: null, unused_index_18: null, unused_index_19: null, - send_node: 'SendNoteArgs', + send_note: 'SendNoteArgs', unused_index_21: null, unused_index_22: null, unused_index_23: null, diff --git a/packages/worker-api/src/integriteeWorker.spec.ts b/packages/worker-api/src/integriteeWorker.spec.ts index 1605f15..2f8c620 100644 --- a/packages/worker-api/src/integriteeWorker.spec.ts +++ b/packages/worker-api/src/integriteeWorker.spec.ts @@ -254,6 +254,26 @@ describe('worker', () => { expect(status.isInSidechainBlock).toBeTruthy(); }); }); + + // race condition so skipped + describe.only('send note should work', () => { + it('send note included', async () => { + const shard = network.shard; + const result = await worker.trustedSendNote( + alice, + shard, + network.mrenclave, + alice.address, + charlie.address, + "Hoi" + ); + console.log('send note', JSON.stringify(result)); + expect(result).toBeDefined(); + const status = worker.createType('TrustedOperationStatus', result.status); + expect(status.isInSidechainBlock).toBeTruthy(); + }); + }); + // race condition so skipped describe.skip('balance transfer should work', () => { it('should return value', async () => { diff --git a/packages/worker-api/src/integriteeWorker.ts b/packages/worker-api/src/integriteeWorker.ts index 72b4f79..acd838b 100644 --- a/packages/worker-api/src/integriteeWorker.ts +++ b/packages/worker-api/src/integriteeWorker.ts @@ -163,6 +163,23 @@ export class IntegriteeWorker extends Worker { return this.sendTrustedCall(signed, shardT); } + public async trustedSendNote( + account: AddressOrPair, + shard: string, + mrenclave: string, + from: String, + to: String, + note: string, + signerOptions?: TrustedSignerOptions, + ): Promise { + const nonce = signerOptions?.nonce ?? await this.getNonce(account, shard, signerOptions) + const shardT = this.createType('ShardIdentifier', bs58.decode(shard)); + const params = this.createType('SendNoteArgs', [from, to, note]) + const call = createTrustedCall(this, ['send_note', 'SendNoteArgs'], params); + const signed = await signTrustedCall(this, call, account, shardT, mrenclave, nonce, signerOptions); + return this.sendTrustedCall(signed, shardT); + } + public async guessTheNumber( account: AddressOrPair, shard: string,