11import { Blockchain , SandboxContract , TreasuryContract } from "@ton/sandbox" ;
2- import { Cell , CommonMessageInfoInternal , Message , toNano } from "@ton/core" ;
2+ import { Cell , CommonMessageInfoInternal , toNano } from "@ton/core" ;
33import "@ton/test-utils" ;
44import { compile } from "@ton/blueprint" ;
55import { HexString , Price } from "@pythnetwork/price-service-sdk" ;
@@ -95,6 +95,7 @@ const TEST_GOVERNANCE_DATA_SOURCES: DataSource[] = [
9595 "0000000000000000000000000000000000000000000000000000000000000000" ,
9696 } ,
9797] ;
98+ const CUSTOM_PAYLOAD = Buffer . from ( "1234567890abcdef" , "hex" ) ;
9899
99100describe ( "PythTest" , ( ) => {
100101 let code : Cell ;
@@ -1000,7 +1001,9 @@ describe("PythTest", () => {
10001001 sentValue ,
10011002 [ BTC_PRICE_FEED_ID , ETH_PRICE_FEED_ID ] ,
10021003 HERMES_BTC_PUBLISH_TIME ,
1003- HERMES_BTC_PUBLISH_TIME
1004+ HERMES_BTC_PUBLISH_TIME ,
1005+ deployer . address ,
1006+ CUSTOM_PAYLOAD
10041007 ) ;
10051008
10061009 // Verify transaction success and message count
@@ -1088,6 +1091,20 @@ describe("PythTest", () => {
10881091
10891092 // Verify this is the end of the chain
10901093 expect ( ethCs . remainingRefs ) . toBe ( 0 ) ;
1094+
1095+ // Verify sender address
1096+ const senderAddress = cs . loadAddress ( ) ;
1097+ expect ( senderAddress ?. toString ( ) ) . toBe ( deployer . address . toString ( ) ) ;
1098+
1099+ // Verify custom payload
1100+ const customPayloadCell = cs . loadRef ( ) ;
1101+ const customPayloadSlice = customPayloadCell . beginParse ( ) ;
1102+ const receivedPayload = Buffer . from (
1103+ customPayloadSlice . loadBuffer ( CUSTOM_PAYLOAD . length )
1104+ ) ;
1105+ expect ( receivedPayload . toString ( "hex" ) ) . toBe (
1106+ CUSTOM_PAYLOAD . toString ( "hex" )
1107+ ) ;
10911108 } ) ;
10921109
10931110 it ( "should successfully parse unique price feed updates" , async ( ) => {
@@ -1101,7 +1118,9 @@ describe("PythTest", () => {
11011118 sentValue ,
11021119 [ BTC_PRICE_FEED_ID , ETH_PRICE_FEED_ID ] ,
11031120 HERMES_BTC_PUBLISH_TIME ,
1104- 60
1121+ 60 ,
1122+ deployer . address ,
1123+ CUSTOM_PAYLOAD
11051124 ) ;
11061125
11071126 // Verify transaction success and message count
@@ -1189,6 +1208,20 @@ describe("PythTest", () => {
11891208
11901209 // Verify this is the end of the chain
11911210 expect ( ethCs . remainingRefs ) . toBe ( 0 ) ;
1211+
1212+ // Verify sender address
1213+ const senderAddress = cs . loadAddress ( ) ;
1214+ expect ( senderAddress ?. toString ( ) ) . toBe ( deployer . address . toString ( ) ) ;
1215+
1216+ // Verify custom payload
1217+ const customPayloadCell = cs . loadRef ( ) ;
1218+ const customPayloadSlice = customPayloadCell . beginParse ( ) ;
1219+ const receivedPayload = Buffer . from (
1220+ customPayloadSlice . loadBuffer ( CUSTOM_PAYLOAD . length )
1221+ ) ;
1222+ expect ( receivedPayload . toString ( "hex" ) ) . toBe (
1223+ CUSTOM_PAYLOAD . toString ( "hex" )
1224+ ) ;
11921225 } ) ;
11931226
11941227 it ( "should fail to parse invalid price feed updates" , async ( ) => {
@@ -1203,7 +1236,9 @@ describe("PythTest", () => {
12031236 toNano ( "1" ) ,
12041237 [ BTC_PRICE_FEED_ID , ETH_PRICE_FEED_ID ] ,
12051238 HERMES_BTC_PUBLISH_TIME ,
1206- HERMES_BTC_PUBLISH_TIME
1239+ HERMES_BTC_PUBLISH_TIME ,
1240+ deployer . address ,
1241+ CUSTOM_PAYLOAD
12071242 ) ;
12081243
12091244 // Verify transaction success and message count
@@ -1226,7 +1261,9 @@ describe("PythTest", () => {
12261261 sentValue ,
12271262 [ BTC_PRICE_FEED_ID , ETH_PRICE_FEED_ID ] ,
12281263 HERMES_BTC_PUBLISH_TIME + 1 ,
1229- HERMES_BTC_PUBLISH_TIME + 1
1264+ HERMES_BTC_PUBLISH_TIME + 1 ,
1265+ deployer . address ,
1266+ CUSTOM_PAYLOAD
12301267 ) ;
12311268
12321269 // Verify transaction success and message count
@@ -1249,7 +1286,9 @@ describe("PythTest", () => {
12491286 sentValue ,
12501287 [ BTC_PRICE_FEED_ID , ETH_PRICE_FEED_ID ] ,
12511288 HERMES_BTC_PUBLISH_TIME ,
1252- 60
1289+ 60 ,
1290+ deployer . address ,
1291+ CUSTOM_PAYLOAD
12531292 ) ;
12541293
12551294 // Verify transaction success and message count
@@ -1272,7 +1311,9 @@ describe("PythTest", () => {
12721311 sentValue ,
12731312 [ ETH_PRICE_FEED_ID , BTC_PRICE_FEED_ID ] ,
12741313 HERMES_BTC_PUBLISH_TIME ,
1275- HERMES_BTC_PUBLISH_TIME
1314+ HERMES_BTC_PUBLISH_TIME ,
1315+ deployer . address ,
1316+ CUSTOM_PAYLOAD
12761317 ) ;
12771318
12781319 // Verify transaction success and message count
@@ -1291,6 +1332,10 @@ describe("PythTest", () => {
12911332 ( outMessage . info as CommonMessageInfoInternal ) . value . coins
12921333 ) . toBeGreaterThan ( 0 ) ;
12931334
1335+ expect ( ( outMessage . info as CommonMessageInfoInternal ) . dest . toString ( ) ) . toBe (
1336+ deployer . address . toString ( )
1337+ ) ;
1338+
12941339 const cs = outMessage . body . beginParse ( ) ;
12951340
12961341 // Verify message header
@@ -1373,7 +1418,9 @@ describe("PythTest", () => {
13731418 sentValue ,
13741419 [ ETH_PRICE_FEED_ID , BTC_PRICE_FEED_ID ] ,
13751420 HERMES_BTC_PUBLISH_TIME ,
1376- 60
1421+ 60 ,
1422+ deployer . address ,
1423+ CUSTOM_PAYLOAD
13771424 ) ;
13781425
13791426 // Verify transaction success and message count
0 commit comments