Skip to content

Commit 598174a

Browse files
committed
order
1 parent a8e1e01 commit 598174a

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/relay/rpc/order.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ export default class Order
3131
{
3232
return getOrderHash(order);
3333
}
34+
35+
storeDatasInShortTerm (hash, origin)
36+
{
37+
return storeDatasInShortTerm(this.host, hash, origin);
38+
}
3439
}
3540

3641
/**
@@ -172,3 +177,32 @@ export function getOrderHash (order)
172177
];
173178
return soliditySHA3(orderTypes, orderData);
174179
}
180+
181+
/**
182+
* @description Submit some datas to relay that will store in a short term (24H)
183+
* @param host
184+
* @param hash
185+
* @param origin
186+
* @returns {Promise.<*>}
187+
*/
188+
export function storeDatasInShortTerm (host, hash, origin)
189+
{
190+
try
191+
{
192+
validator.validate({value: hash, type: 'STRING'});
193+
validator.validate({value: origin, type: 'STRING'});
194+
}
195+
catch (e)
196+
{
197+
return Promise.resolve(new Response(code.PARAM_INVALID.code, code.PARAM_INVALID.msg));
198+
}
199+
const body = {};
200+
body.method = 'loopring_setOrderTransfer';
201+
body.params = [{hash, origin}];
202+
body.id = id();
203+
body.jsonrpc = '2.0';
204+
return request(host, {
205+
method: 'post',
206+
body
207+
});
208+
}

0 commit comments

Comments
 (0)