diff --git a/README.md b/README.md index 3ae3795..8ae6896 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,11 @@ iota.sendTransaction("RECEIVEADDRESS9999",1).then((success)=>{ //with await async const success = await iota.sendTransaction("RECEIVEADDRESS9999",1); +//sending data +const success = await iota.sendTransaction("RECEIVEADDRESS9999",1, {data: "someData"}); + +//sending data with valid tag (27 characters or less, all TRYTES) +const success = await iota.sendTransaction("RECEIVEADDRESS9999",1, {data: "someData"}, "TAG9"); //getting accountdata for your seed const accountData = await iota.getAccountData(); diff --git a/__tests__/iota-basic-spec.ts b/__tests__/iota-basic-spec.ts index 296f5a0..76fc331 100644 --- a/__tests__/iota-basic-spec.ts +++ b/__tests__/iota-basic-spec.ts @@ -228,4 +228,3 @@ test('Should call the localAttach of CurlHashWebGl when on node when attachToTan // expect(iotaClient.valid.isAddress(seed)).toBe(true); // expect(seedGenerator instanceof SeedGeneratorWeb).toBe(true); // }); - diff --git a/package.json b/package.json index 8f37a75..db88fe6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iota-basic", - "version": "2.0.0", + "version": "2.1.0", "description": "a library for basic interactions with the iota tangle", "license": "GPL-3.0", "repository": "https://github.com/thedewpoint/iota-basic.git", @@ -39,7 +39,7 @@ "dependencies": { "ccurl.interface.js": "0.0.6", "curl.lib.js": "^1.0.22", - "iota.lib.js": "^0.4.6" + "iota.lib.js": "^0.4.7" }, "devDependencies": { "@types/jest": "22.0.0", diff --git a/src/api/AccountData.ts b/src/api/AccountData.ts index beba189..3815448 100644 --- a/src/api/AccountData.ts +++ b/src/api/AccountData.ts @@ -54,4 +54,5 @@ export interface ITransaction { address: string; value: number; message: string; + tag: string; } diff --git a/src/api/IotaBasic.ts b/src/api/IotaBasic.ts index ac1cc95..433fe0a 100644 --- a/src/api/IotaBasic.ts +++ b/src/api/IotaBasic.ts @@ -9,7 +9,8 @@ export interface IIotaBasic { sendTransaction( receivingAddress: string, value: number, - data?: any + data?: any, + tag?: string ): Promise; getChecksum(): string; getBalance(): Promise; diff --git a/src/impl/IotaBasic.ts b/src/impl/IotaBasic.ts index 3d97292..5df8b66 100644 --- a/src/impl/IotaBasic.ts +++ b/src/impl/IotaBasic.ts @@ -74,11 +74,13 @@ export class Iota implements IIotaBasic { * @param {string} receiveAddress - the address to send to * @param {number} value - the amount in iota to send * @param {any} data - json object representing any data you want to send with the transaction + * @param {string} tag - string containing tag for transaction */ public sendTransaction( receivingAddress: string, value: number, - data?: any + data?: any, + tag: string = '' ): Promise { return new Promise((resolve, reject) => { const message = data @@ -87,6 +89,7 @@ export class Iota implements IIotaBasic { const transaction: ITransaction = { address: receivingAddress, message, + tag, value, }; const transactions: ITransaction[] = [transaction];