@@ -3,9 +3,10 @@ import {
3
3
approveAssetTransfer ,
4
4
checkApprovedAssetCreation ,
5
5
approveAssetCreation ,
6
- signOrder ,
7
6
performOrder ,
8
- provider
7
+ provider ,
8
+ signOrderAccount1 ,
9
+ signOrderAccount2
9
10
} from "./src/example" ;
10
11
import { config } from "./src/config" ;
11
12
@@ -37,37 +38,47 @@ btnSignOrder.addEventListener("click", async () => {
37
38
return ;
38
39
}
39
40
40
- if ( provider . accountId !== config . account1Id ) {
41
- printWarning ( "Select account1 in metamask to sign this order." ) ;
42
- return ;
43
- }
41
+ if ( provider . accountId === config . account1Id ) {
42
+ let error = null ;
43
+ await signOrderAccount1 ( ) . catch ( e => {
44
+ error = e ;
45
+ printError ( e ) ;
46
+ } ) ;
44
47
45
- let error = null ;
46
- await signOrder ( ) . catch ( e => {
47
- error = e ;
48
- printError ( e ) ;
49
- } ) ;
48
+ if ( ! error ) {
49
+ printMessage (
50
+ "Order signing with account1 sucessfull: " + config . signatureAccount1
51
+ ) ;
52
+ }
53
+ } else if ( provider . accountId === config . account2Id ) {
54
+ let error = null ;
55
+ await signOrderAccount2 ( ) . catch ( e => {
56
+ error = e ;
57
+ printError ( e ) ;
58
+ } ) ;
50
59
51
- if ( ! error ) {
52
- printMessage ( "Order signing sucessfull: " + config . signature ) ;
60
+ if ( ! error ) {
61
+ printMessage (
62
+ "Order signing with account2 sucessfull: " + config . signatureAccount2
63
+ ) ;
64
+ }
65
+ } else {
66
+ printWarning ( "Select account1 or account2 in metamask to sign this order." ) ;
53
67
}
54
68
} ) ;
55
69
56
70
btnPerformOrder . addEventListener ( "click" , async ( ) => {
57
- if ( config . assetLedgerId === "" ) {
71
+ if ( config . signatureAccount1 === "" ) {
58
72
printWarning (
59
- "No assetLedgerSource defined. Either deploy a new asset ledger or set asset ledger source in src/config.ts file ."
73
+ "No signature from account 1 provided. Please sign order with account 1 ."
60
74
) ;
61
75
return ;
62
76
}
63
77
64
- if ( config . account2Id === "" ) {
65
- printWarning ( "No account2Id defined. Please set it in src/config.ts file." ) ;
66
- return ;
67
- }
68
-
69
- if ( provider . accountId !== config . account2Id ) {
70
- printWarning ( "Select account2 in metamask to perform this order." ) ;
78
+ if ( config . signatureAccount2 === "" ) {
79
+ printWarning (
80
+ "No signature from account 2 provided. Please sign order with account 2."
81
+ ) ;
71
82
return ;
72
83
}
73
84
0 commit comments