@@ -654,11 +654,7 @@ describe("Sign Client Integration", () => {
654
654
chains : [ "hedera:mainnet" ] ,
655
655
} ,
656
656
near : {
657
- methods : [
658
- "near_signTransaction" ,
659
- "near_signAndExecuteTransaction" ,
660
- "near_signAndExecuteTransactions" ,
661
- ] ,
657
+ methods : [ "near_signTransaction" , "near_signTransactions" ] ,
662
658
events : [ ] ,
663
659
chains : [ "near:testnet" ] ,
664
660
} ,
@@ -727,11 +723,7 @@ describe("Sign Client Integration", () => {
727
723
accounts : [ "hedera:mainnet:0x" ] ,
728
724
} ,
729
725
near : {
730
- methods : [
731
- "near_signTransaction" ,
732
- "near_signAndExecuteTransaction" ,
733
- "near_signAndExecuteTransactions" ,
734
- ] ,
726
+ methods : [ "near_signTransaction" , "near_signTransactions" ] ,
735
727
events : [ ] ,
736
728
chains : [ "near:testnet" ] ,
737
729
accounts : [ "near:testnet:0x" ] ,
@@ -1529,7 +1521,7 @@ describe("Sign Client Integration", () => {
1529
1521
} ) ,
1530
1522
] ) ;
1531
1523
1532
- // near near_signAndExecuteTransactions example
1524
+ // near near_signTransactions example
1533
1525
await Promise . all ( [
1534
1526
new Promise < void > ( ( resolve ) => {
1535
1527
clients . B . once ( "session_request" , async ( args ) => {
@@ -1540,110 +1532,20 @@ describe("Sign Client Integration", () => {
1540
1532
expect ( id ) . toEqual ( args . id ) ;
1541
1533
const expectedTxHashes = [
1542
1534
"EpHx79wKAn6br4G9aKaCGLpdzNc8YjrthiFonXQgskAx" ,
1543
- "EpHx79wKAn6br4G9aKaCGLpdzNc8YjrthiFonXQgskAb" ,
1544
- ] ;
1545
- const transactions = [
1546
- {
1547
- transaction : {
1548
- hash : expectedTxHashes [ 0 ] ,
1549
- } ,
1550
- } ,
1551
- {
1552
- transaction : {
1553
- hash : expectedTxHashes [ 1 ] ,
1554
- } ,
1555
- } ,
1535
+ "EpHx79wKAn6br4G9aKaCGLpdzNc8YjrthiFonXQgskAx" ,
1556
1536
] ;
1537
+ const signedTransaction = new Uint8Array ( [
1538
+ 16 , 0 , 0 , 0 , 48 , 120 , 103 , 97 , 110 , 99 , 104 , 111 , 46 , 116 , 101 , 115 , 116 , 110 ,
1539
+ 101 , 116 , 0 , 243 , 74 , 204 , 31 , 29 , 80 , 146 , 149 , 102 , 175 , 8 , 83 , 231 , 187 , 5 ,
1540
+ 120 , 41 , 115 , 247 , 22 , 197 , 120 , 182 , 242 , 120 , 135 , 73 , 137 , 166 , 246 , 171 , 103 ,
1541
+ 77 , 243 , 34 , 42 , 212 , 180 , 0 , 0 , 16 , 0 , 0 , 0 , 48 , 120 , 103 , 97 , 110 , 99 , 104 , 111 ,
1542
+ 46 , 116 , 101 , 115 , 116 , 110 , 101 , 116 , 5 , 233 , 95 , 227 , 45 , 10 , 101 , 176 , 111 ,
1543
+ 124 , 190 , 86 , 106 , 27 , 143 , 54 , 148 , 125 , 132 , 252 , 25 , 71 , 125 , 78 , 60 , 242 , 100 ,
1544
+ 219 , 40 , 168 , 65 , 3 , 1 , 0 , 0 , 0 , 3 , 0 , 0 , 0 , 161 , 237 , 204 , 206 , 27 , 194 , 211 , 0 ,
1545
+ 0 , 0 , 0 , 0 , 0 ,
1546
+ ] ) ;
1557
1547
1558
- const result = formatJsonRpcResult ( id , transactions ) ;
1559
-
1560
- let checkedWalletPublish = false ;
1561
- clients . B . core . relayer . once ( RELAYER_EVENTS . publish , ( publishPayload : any ) => {
1562
- const tvf = publishPayload . tvf ;
1563
- if ( ! tvf ) {
1564
- return console . error ( "near tvf is undefined" ) ;
1565
- }
1566
- if ( ! tvf . chainId || ! tvf . rpcMethods || ! tvf . txHashes ) {
1567
- return console . error ( "near tvf is missing required fields" ) ;
1568
- }
1569
- if (
1570
- tvf . rpcMethods . length !== 1 &&
1571
- tvf . rpcMethods [ 0 ] !== "near_signAndExecuteTransactions"
1572
- ) {
1573
- return console . error ( "near tvf rpcMethods is invalid" , tvf . rpcMethods ) ;
1574
- }
1575
- if ( tvf . txHashes . join ( "," ) !== expectedTxHashes . join ( "," ) ) {
1576
- return console . error (
1577
- "near txHashes do not match: transactionId" ,
1578
- tvf . txHashes ,
1579
- result . result ,
1580
- ) ;
1581
- }
1582
-
1583
- checkedWalletPublish = true ;
1584
- } ) ;
1585
-
1586
- await clients . B . respond ( {
1587
- topic,
1588
- response : result ,
1589
- } ) ;
1590
-
1591
- expect ( checkedWalletPublish ) . to . be . true ;
1592
- resolve ( ) ;
1593
- } ) ;
1594
- } ) ,
1595
- new Promise < void > ( async ( resolve ) => {
1596
- const requestParams = {
1597
- method : "near_signAndExecuteTransactions" ,
1598
- params : [
1599
- {
1600
- data : "0xdeadbeef" ,
1601
- } ,
1602
- ] ,
1603
- } ;
1604
- let checkedDappPublish = false ;
1605
-
1606
- clients . A . core . relayer . once ( RELAYER_EVENTS . publish , ( publishPayload : any ) => {
1607
- checkedDappPublish = true ;
1608
- const tvf = publishPayload . tvf ;
1609
- expect ( tvf ) . to . exist ;
1610
- expect ( tvf ?. chainId ) . to . eq ( TEST_REQUEST_PARAMS . chainId ) ;
1611
- expect ( tvf ?. rpcMethods ) . to . eql ( [ requestParams . method ] ) ;
1612
- expect ( tvf ?. txHashes ) . to . be . undefined ;
1613
- expect ( tvf ?. contractAddresses ) . to . eql ( [ requestParams . params [ 0 ] . to ] ) ;
1614
- } ) ;
1615
-
1616
- await clients . A . request ( {
1617
- topic,
1618
- ...TEST_REQUEST_PARAMS ,
1619
- request : {
1620
- ...TEST_REQUEST_PARAMS . request ,
1621
- ...requestParams ,
1622
- } ,
1623
- chainId : "near:testnet" ,
1624
- } ) ;
1625
- expect ( checkedDappPublish ) . to . be . true ;
1626
- resolve ( ) ;
1627
- } ) ,
1628
- ] ) ;
1629
-
1630
- // near near_signAndExecuteTransaction example
1631
- await Promise . all ( [
1632
- new Promise < void > ( ( resolve ) => {
1633
- clients . B . once ( "session_request" , async ( args ) => {
1634
- const pendingRequests = clients . B . pendingRequest . getAll ( ) ;
1635
- const { id, topic, params } = pendingRequests [ 0 ] ;
1636
- expect ( params ) . toEqual ( args . params ) ;
1637
- expect ( topic ) . toEqual ( args . topic ) ;
1638
- expect ( id ) . toEqual ( args . id ) ;
1639
- const expectedTxHashes = [ "EpHx79wKAn6br4G9aKaCGLpdzNc8YjrthiFonXQgskAx" ] ;
1640
- const transaction = {
1641
- transaction : {
1642
- hash : expectedTxHashes [ 0 ] ,
1643
- } ,
1644
- } ;
1645
-
1646
- const result = formatJsonRpcResult ( id , transaction ) ;
1548
+ const result = formatJsonRpcResult ( id , [ signedTransaction , signedTransaction ] ) ;
1647
1549
1648
1550
let checkedWalletPublish = false ;
1649
1551
clients . B . core . relayer . once ( RELAYER_EVENTS . publish , ( publishPayload : any ) => {
@@ -1656,15 +1558,15 @@ describe("Sign Client Integration", () => {
1656
1558
}
1657
1559
if (
1658
1560
tvf . rpcMethods . length !== 1 &&
1659
- tvf . rpcMethods [ 0 ] !== "near_signAndExecuteTransaction "
1561
+ tvf . rpcMethods [ 0 ] !== "near_signTransactions "
1660
1562
) {
1661
1563
return console . error ( "near tvf rpcMethods is invalid" , tvf . rpcMethods ) ;
1662
1564
}
1663
1565
if ( tvf . txHashes . join ( "," ) !== expectedTxHashes . join ( "," ) ) {
1664
1566
return console . error (
1665
1567
"near txHashes do not match: transactionId" ,
1666
1568
tvf . txHashes ,
1667
- result . result ,
1569
+ expectedTxHashes ,
1668
1570
) ;
1669
1571
}
1670
1572
@@ -1682,7 +1584,7 @@ describe("Sign Client Integration", () => {
1682
1584
} ) ,
1683
1585
new Promise < void > ( async ( resolve ) => {
1684
1586
const requestParams = {
1685
- method : "near_signAndExecuteTransaction " ,
1587
+ method : "near_signTransactions " ,
1686
1588
params : [
1687
1589
{
1688
1590
data : "0xdeadbeef" ,
0 commit comments