-
Notifications
You must be signed in to change notification settings - Fork 1
/
createCIP22DeeplinkExamples.js
55 lines (49 loc) · 1.36 KB
/
createCIP22DeeplinkExamples.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* This small script can be used to generate test deep links
*
* To test with the android app you can use the adb tool
*
* adb shell am start -W -a android.intent.action.VIEW -d "signum://v1?action=pay..."
*/
const {createDeeplink} = require('@signumjs/util');
/**
{
"recipient": "S-9K9L-4CB5-88Y5-F5G4Z",
"amountPlanck": 10000000,
"feePlanck": 735000,
"message": "Hi, from a deep link",
"messageIsText": true,
"immutable": true,
"deadline": 24,
"encrypt": false
}
*/
const PayExampleA = {
recipient: 'S-BNUE-9X8X-ATP8-FF3YB',
amountPlanck: '10000000',
feePlanck: 735000,
message: '59b13cb7d10d5ead3b45b8e9039ebed100000000000000000000000000000000',
messageIsText: false,
immutable: false,
};
const PayExampleB = {
recipient: 'S-9K9L-4CB5-88Y5-F5G4Z',
immutable: false,
deadline: 24,
encrypt: true,
};
const exampleA = createDeeplink({action: 'pay', payload: PayExampleA});
const exampleB = createDeeplink({action: 'pay', payload: PayExampleB});
console.info('Example A');
console.info('=========');
console.info(exampleA);
console.info('');
console.info('Bash Escaped');
console.info(exampleA.replace('&', '\\&'));
console.info('--------------------');
console.info('Example B');
console.info('=========');
console.info(exampleB);
console.info('');
console.info('Bash Escaped');
console.info(exampleB.replace('&', '\\&'));