Skip to content

Commit

Permalink
feat(iotabasic): added tags, upgraded iota.lib.js version
Browse files Browse the repository at this point in the history
  • Loading branch information
thedewpoint committed Feb 8, 2018
1 parent 69fd1e7 commit 371d29c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion __tests__/iota-basic-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// });

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/api/AccountData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ export interface ITransaction {
address: string;
value: number;
message: string;
tag: string;
}
3 changes: 2 additions & 1 deletion src/api/IotaBasic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export interface IIotaBasic {
sendTransaction(
receivingAddress: string,
value: number,
data?: any
data?: any,
tag?: string
): Promise<any>;
getChecksum(): string;
getBalance(): Promise<number>;
Expand Down
5 changes: 4 additions & 1 deletion src/impl/IotaBasic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any> {
return new Promise<any>((resolve, reject) => {
const message = data
Expand All @@ -87,6 +89,7 @@ export class Iota implements IIotaBasic {
const transaction: ITransaction = {
address: receivingAddress,
message,
tag,
value,
};
const transactions: ITransaction[] = [transaction];
Expand Down

0 comments on commit 371d29c

Please sign in to comment.