@ton-agent-kit/plugin-escrow 1.1.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/contracts/Escrow_Escrow.code.boc +0 -0
- package/src/contracts/Escrow_Escrow.ts +1 -1
- package/src/utils.ts +168 -168
package/package.json
CHANGED
|
Binary file
|
|
@@ -1924,7 +1924,7 @@ function initEscrow_init_args(src: Escrow_init_args) {
|
|
|
1924
1924
|
}
|
|
1925
1925
|
|
|
1926
1926
|
async function Escrow_init(depositor: Address, beneficiary: Address, deadline: bigint, minArbiters: bigint, minStake: bigint, reputationContract: Address, requireRepCollateral: boolean, minRepScore: bigint, baseSellerStake: bigint) {
|
|
1927
|
-
const __code = Cell.fromHex('b5ee9c724102460100141600022cff008e88f4a413f4bcf2c80bed53208e8130e1ed43d90107020378e002040325b96c0ed44d0d20001e30fdb3c57105f0f6ca18080a030008f8276f1003d5bbed2ed44d0d20001e30fdb3c571757175717571757175717571757175717571757175717571757175717571757175717571757175717571757175717571757171113111611131112111511121111111411111110111311100f11120f0e11110e0d11100d10cf10be552a8080a0501f4f8235616be9256129170e2935614b39170e2935613b39170e2935611b39170e2f8235617be935613b39170e2935615b39170e2935614b39170e2935612b39170e2561b02561b02561b02561b02561b02561b02561b02561b02561b02561b02561402561402561402561e02561e0256160256160256160256160206000c561602561659048201d072d721d200d200fa4021103450666f04f86102f862ed44d0d20001e30f111b945f0f5f0ce01119d70d1ff2e082218210f19f83efbae302218210f8aa2f92ba080a0b0d01f6fa40fa40fa40fa00d31fd200d200d200d200d31fd307d401d0fa00f404f404f404d430d0f404f404d30fd30fd30ffa00d200d200fa00d200d307300f111a0f0f11190f0f11180f0f11170f0f11160f0f11150f0f11140f0f11130f0f11120f0f11110f0f11100f571a1118111911181117111811171116111711160900541115111611151114111511141113111411131112111311121111111211111110111111100f11100f550e00f4fa40fa40810101d700d401d0810101d700810101d700fa40d200d430d0810101d700810101d7003010691068106709d155076d6d6d6d6d707070707054744453007056121114111711140b11160b1114111511140a11140a0911130908111208071111070611100610bf10ae106d10bc10ab106a10691058552401fe5b33815c50f8425617c705f2f48116595612b3935611b39170e2f2f420f2e78d8200e85002b312f2f48200c718f8416f24135f03c200f2f4f8416f24135f031116111811161115111711151114111611141113111511131112111411121111111311111110111211100f11110f0e11100e10df10ce10bd10ac109b108a10790c011c1068105710461035047f4344db3c4404fa8ee55b21978200f23123f2f4def8416f24135f0301111501a011171119111711161118111611151117111511161113111511131112111411121111111311111110111211100f11110f0e11100e10df10ce10bd10ac109b108a107910681057104610354403db3ce0218210d2d77e02bae3022182101856d189bae30221440e0f1201da5b5710820097dbf8425618c705f2f48116595612b3935611b39170e2f2f41116111811161115111711151114111611141113111511131112111411121111111311111110111211107f11120f11110f0e11100e10df10ce10bd10ac109b108a107910681057104610354403db3c4402fe5b8116591113b3935611b39170e201111301f2f48164272fb3f2f48200af75f8425618c705f2f48200a1c75614c200f2f47f708100827088561a553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb001117111911171116111811161011002600000000457363726f772072656c6561736564018411151117111511141116111411131115111311141111111311111110111211100f11110f0e11100e10df10ce10bd10ac109b108a107910681057104610354403db3c44044a821083fb1615bae302218210464d5ef3bae3022182109ec0cde6bae302218210c28a4884ba1316191d02fe5b8116595613b3931112b393571270e201111201f2f48164272fb3f2f48200a1c75614c200f2f4f8235613b99c8200f74df8425618c705f2f4982f95812a05f2f0dee27f708100827088561b553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e21415002600000000457363726f7720726566756e64656401aaf400c901fb0011171119111711161118111611151117111511141116111411131115111311121114111211131110111211100f11110f0e11100e10df10ce10bd10ac109b108a10791068105710461035443012db3c4402fc5b8200bc49f8235615bef2f48200cc285611f2f48116591113b3935611b39170e201111301f2f42eb3f2e4a18200a1c75614c200f2f47f708100827088561a553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb0011171119111717180040000000004175746f2d72656c656173656420616674657220646561646c696e65019011161118111611151117111511141116111411131115111311141111111311111110111211100f11110f0e11100e10df10ce10bd10ac109b108a107910681057104610354403db3c4401fe5b3e8200e28cf8425618c705917f96f8425617c705e2f2f48116595612b3935611b39170e2f2f48200ae570fb31ff2f47ff8238203f480a08209c9c380727ff828561b561b561a27c8554082102f7e50595006cb1f14ce12cece01fa02cb1fc95619553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e1a02fc016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb00f842708042708810246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb001117111911171116111811161115111711151114111611141113111511131112111411121b1c00240000000044697370757465206f70656e6564015811111113111111101112111001111101111010df10ce10bd10ac109b108a107910681057104610354400db3c4402fc8efa5b81575a5610f2f48116595613b3935612b39170e2f2f4813c8df8235610b9f2f4810f8927c164f2f4813ce7f8425619c705b3f2f482009100f8425618c705b3f2f481010bf8422c598101014133f40a6fa19401d70030925b6de281654b016ef2f4f8416f24135f038126e7531ebef2f4810101f84229103f01e0211e2001f6206e953059f45a30944133f414e281010bf84229103e810101216e955b59f4593098c801cf004133f441e281010120103c54491350ff216e955b59f45a3098c801cf004133f442e208810101277071216e955b59f45a3098c801cf004133f442e206a41117111911171116111811161115111711151114111611141f016c1113111511131112111411121111111311111110111211100f11110f0e11100e10df10ce5e2a108b5e3608105710461035440302db3c4402fe820aaade5bba8ef75b81575a5610f2f48116595613b3935612b39170e2f2f48153fa537ebef2f481010bf8422c598101014133f40a6fa19401d70030925b6de2814a09216eb3f2f4206ef2d0802981010122714133f40c6fa19401d70030925b6de2812583216eb3f2f48200e7e901206ef2d080c000f2f4098101012a7f7121280372216e955b59f45a3098c801cf004133f442e218810101500a7f71216e955b59f45a3098c801cf004133f442e205a426ab00a45210bee30fdb3c22254404fe57121116111811161115111711151114111611141113111511131112111411127f11141111111311111110111211100f11110f0e11100e10df10ce10bd10ac109b108a5e351067104610354403db3c708100827088561c553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf818ae2f4003d23392400380000000052656c6561736564206279206172626974657220766f74650008c901fb0002fcf842708042708810246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb001117111911171116111811161115111711151114111611141113111511131112111411121111111311111110111211100f11110f0e11100e10df10ce10bd10ac2627002800000000566f74656420746f2072656c656173650012109b108a5e35075514044ee02182104cbc6df3bae30221821080432205bae302218210dcaf1044bae302018210946a98b6ba29313b4201ee5b81575a5610f2f48116595613b3935612b39170e2f2f48153fa537ebef2f481010bf8422c598101014133f40a6fa19401d70030925b6de2814a09216eb3f2f4206ef2d0802981010122714133f40c6fa19401d70030925b6de2812583216eb3f2f48200e7e901206ef2d080c000f2f4098101012a7f712a0372216e955b59f45a3098c801cf004133f442e218810101500a7071216e955b59f45a3098c801cf004133f442e204a426ab00a45210bee30fdb3c2b2e4404fe57111116111811161115111711151114111611141113111511131112111411121111111311117f11131110111211100f11110f0e11100e10df10ce10bd10ac109b108a10491068105710461035443012db3c708100827088561d553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf818a3d2c392d003800000000526566756e646564206279206172626974657220766f7465000ee2f400c901fb0002fcf842708042708810246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb001117111911171116111811161115111711151114111611141113111511131112111411121111111311111110111211100f11110f0e11100e10df10ce10bd10ac2f30002600000000566f74656420746f20726566756e640020109b108a10491068105706103544030201f85b8168575613917f925612e2f2f481010bf8422c598101014133f40a6fa19401d70030925b6de2814a09216eb3f2f4206ef2d080810101545b0052304133f40c6fa19401d70030925b6de2812583216eb3f2f482009d7321206ef2d080c200f2f42a81010123714133f40c6fa19401d70030925b6de28174c1216eb33202fe9801206ef2d080c0ff923170e2f2f42981010123714133f40c6fa19401d70030925b6de2206ef2d08020c0ff9256159170e292307f98c0009256139170e2e28101017021104f10231025216e955b59f45a3098c801cf004133f442e201913ae30d111711191117111611181116111511171115111411161114111311151113333a02fc1118111911181117111811171116111711161115111611151114111511141113111411131112111311121111111211111110111111100f11100f10ef10de10cd0b0c5509111adb3c1119111a11191118111a11181117111a11171116111a11161115111a11151114111a11141113111a11131112111a11121111111a1111343601f6702093530ab98e732b81010122714133f40c6fa19401d70030925b6de2206eb38e5520206ef2d080c0ff9256179170e292307f9d206ef2d080c0009256159170e2e28e32810101545e0052304133f40c6fa19401d70030925b6de2206eb39820206ef2d080c2009170e298206ef2d08012a0019130e2df9130e2a4350004e83003f41110111a11100f111a0f0e111a0e0d111a0d0c111a0c0b111a0b0a111a0a09111a09111a0807065540db3c7021c200993001111b01a904111a93571c30e2111b206ef2d08001111aa0f842727088103410246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf818ae2f400c901fb0037383900ec702093530ab98e6c2b81010122714133f40c6fa19401d70030925b6de2206eb38e4e20206ef2d080c0ff9256179170e292307f9d206ef2d080c0009256159170e2e28e2b810101545e0052304133f40c6fa19401d70030925b6de2206eb397206ef2d080c200923070e29301a401dede9130e2a4e8300036000000004172626974657220726577617264202877696e6e657229001a58cf8680cf8480f400f400cf8101401112111411121111111311111110111211100f11110f0e11100e10df551cdb3c4401fc5b81575a5610f2f48116595613b3935612b39170e2f2f48200d92bf8235610bef2f4536db9917f935354bae28e1356109357127f9b57111110111111107f1111e28e145354bc9357127f9b57111110111111107f1111e2e211171119111711161118111611151117111511141116111411131115111311141111111311113c04de1110111211100f11110f0e11100e10df10ce10bd10ac109b108a107910681057104610354403db3c56148ec1708100827088561d553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb00e30d3d3e3f4100c256118e5c8209312d00727ff82856185618c855208210bfa059865004cb1f12ceca00ca00c9561b553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb00de002c0000000046616c6c6261636b3a20726566756e6465640182708100827088561c553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb0040002c0000000046616c6c6261636b3a2072656c65617365640104db3c4401e48ee8d33f30c8018210aff90f5758cb1fcb3fc91118111a11181117111911171116111811161115111711151114111611141113111511131112111411121111111311111110111211100f11110f0e11100e10df10ce10bd10ac109b108a10791068105710461035443012e05f0f5f0cf2c08243014af84270705003804201503304c8cf8580ca00cf8440ce01fa02806acf40f400c901fb00db3c44013ac87f01ca00111a111911181117111611151114111311121111111055e04500ca01111901111ace01111701ce01111501ce011113fa0201111101cb1f1fca001dca001bca0019ca0017cb1f15cb07c85004fa0212f400f40012f40002c8f40013f40013cb0f13cb0f13cb0f5003fa0213ca0013ca005003fa0213ca0013cb0712cdcdc9ed5420b0bc1e');
|
|
1927
|
+
const __code = Cell.fromHex('b5ee9c724102480100147000022cff008e88f4a413f4bcf2c80bed53208e8130e1ed43d90107020378e002040325b96c0ed44d0d20001e30fdb3c57105f0f6ca18080a030008f8276f1003d5bbed2ed44d0d20001e30fdb3c571757175717571757175717571757175717571757175717571757175717571757175717571757175717571757175717571757171113111611131112111511121111111411111110111311100f11120f0e11110e0d11100d10cf10be552a8080a0501f4f8235616be9256129170e2935614b39170e2935613b39170e2935611b39170e2f8235617be935613b39170e2935615b39170e2935614b39170e2935612b39170e2561b02561b02561b02561b02561b02561b02561b02561b02561b02561b02561402561402561402561e02561e0256160256160256160256160206000c561602561659048201d072d721d200d200fa4021103450666f04f86102f862ed44d0d20001e30f111b945f0f5f0ce01119d70d1ff2e082218210f19f83efbae302218210f8aa2f92ba080a0b0d01f6fa40fa40fa40fa00d31fd200d200d200d200d31fd307d401d0fa00f404f404f404d430d0f404f404d30fd30fd30ffa00d200d200fa00d200d307300f111a0f0f11190f0f11180f0f11170f0f11160f0f11150f0f11140f0f11130f0f11120f0f11110f0f11100f571a1118111911181117111811171116111711160900541115111611151114111511141113111411131112111311121111111211111110111111100f11100f550e00f4fa40fa40810101d700d401d0810101d700810101d700fa40d200d430d0810101d700810101d7003010691068106709d155076d6d6d6d6d707070707054744453007056121114111711140b11160b1114111511140a11140a0911130908111208071111070611100610bf10ae106d10bc10ab106a10691058552401fe5b33815c50f8425617c705f2f48116595612b3935611b39170e2f2f420f2e78d8200e85002b312f2f48200c718f8416f24135f03c200f2f4f8416f24135f031116111811161115111711151114111611141113111511131112111411121111111311111110111211100f11110f0e11100e10df10ce10bd10ac109b108a10790c011c1068105710461035047f4344db3c4604fa8ee55b21978200f23123f2f4def8416f24135f0301111501a011171119111711161118111611151117111511161113111511131112111411121111111311111110111211100f11110f0e11100e10df10ce10bd10ac109b108a107910681057104610354403db3ce0218210d2d77e02bae3022182101856d189bae30221460e111402f65b5710820097dbf8425618c705f2f48116595612b3935611b39170e2f2f47ff842708042708810246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb001117111911171116111811161115111711151114111611141113111511130f10002c0000000044656c697665727920636f6e6669726d6564016011121114111211111113111111120f11110f0e11100e10df10ce10bd10ac109b108a107910681057104610354403db3c4602fe5b8116591113b3935611b39170e201111301f2f48164272fb3f2f48200af75f8425618c705f2f48200a1c75614c200f2f47f708100827088561a553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb001117111911171116111811161213002600000000457363726f772072656c6561736564018411151117111511141116111411131115111311141111111311111110111211100f11110f0e11100e10df10ce10bd10ac109b108a107910681057104610354403db3c46044a821083fb1615bae302218210464d5ef3bae3022182109ec0cde6bae302218210c28a4884ba15181b1f02fe5b8116595613b3931112b393571270e201111201f2f48164272fb3f2f48200a1c75614c200f2f4f8235613b99c8200f74df8425618c705f2f4982f95812a05f2f0dee27f708100827088561b553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e21617002600000000457363726f7720726566756e64656401aaf400c901fb0011171119111711161118111611151117111511141116111411131115111311121114111211131110111211100f11110f0e11100e10df10ce10bd10ac109b108a10791068105710461035443012db3c4602fc5b8200bc49f8235615bef2f48200cc285611f2f48116591113b3935611b39170e201111301f2f42eb3f2e4a18200a1c75614c200f2f47f708100827088561a553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb00111711191117191a0040000000004175746f2d72656c656173656420616674657220646561646c696e65019011161118111611151117111511141116111411131115111311141111111311111110111211100f11110f0e11100e10df10ce10bd10ac109b108a107910681057104610354403db3c4601fe5b3e8200e28cf8425618c705917f96f8425617c705e2f2f48116595612b3935611b39170e2f2f48200ae570fb31ff2f47ff8238203f480a08209c9c380727ff828561b561b561a27c8554082102f7e50595006cb1f14ce12cece01fa02cb1fc95619553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e1c02fc016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb00f842708042708810246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb001117111911171116111811161115111711151114111611141113111511131112111411121d1e00240000000044697370757465206f70656e6564015811111113111111101112111001111101111010df10ce10bd10ac109b108a107910681057104610354400db3c4602fc8efa5b81575a5610f2f48116595613b3935612b39170e2f2f4813c8df8235610b9f2f4810f8927c164f2f4813ce7f8425619c705b3f2f482009100f8425618c705b3f2f481010bf8422c598101014133f40a6fa19401d70030925b6de281654b016ef2f4f8416f24135f038126e7531ebef2f4810101f84229103f01e021202201f6206e953059f45a30944133f414e281010bf84229103e810101216e955b59f4593098c801cf004133f441e281010120103c54491350ff216e955b59f45a3098c801cf004133f442e208810101277071216e955b59f45a3098c801cf004133f442e206a411171119111711161118111611151117111511141116111421016c1113111511131112111411121111111311111110111211100f11110f0e11100e10df10ce5e2a108b5e3608105710461035440302db3c4602fe820aaade5bba8ef75b81575a5610f2f48116595613b3935612b39170e2f2f48153fa537ebef2f481010bf8422c598101014133f40a6fa19401d70030925b6de2814a09216eb3f2f4206ef2d0802981010122714133f40c6fa19401d70030925b6de2812583216eb3f2f48200e7e901206ef2d080c000f2f4098101012a7f71232a0372216e955b59f45a3098c801cf004133f442e218810101500a7f71216e955b59f45a3098c801cf004133f442e205a426ab00a45210bee30fdb3c24274604fe57121116111811161115111711151114111611141113111511131112111411127f11141111111311111110111211100f11110f0e11100e10df10ce10bd10ac109b108a5e351067104610354403db3c708100827088561c553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf818ae2f4003f253b2600380000000052656c6561736564206279206172626974657220766f74650008c901fb0002fcf842708042708810246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb001117111911171116111811161115111711151114111611141113111511131112111411121111111311111110111211100f11110f0e11100e10df10ce10bd10ac2829002800000000566f74656420746f2072656c656173650012109b108a5e35075514044ee02182104cbc6df3bae30221821080432205bae302218210dcaf1044bae302018210946a98b6ba2b333d4401ee5b81575a5610f2f48116595613b3935612b39170e2f2f48153fa537ebef2f481010bf8422c598101014133f40a6fa19401d70030925b6de2814a09216eb3f2f4206ef2d0802981010122714133f40c6fa19401d70030925b6de2812583216eb3f2f48200e7e901206ef2d080c000f2f4098101012a7f712c0372216e955b59f45a3098c801cf004133f442e218810101500a7071216e955b59f45a3098c801cf004133f442e204a426ab00a45210bee30fdb3c2d304604fe57111116111811161115111711151114111611141113111511131112111411121111111311117f11131110111211100f11110f0e11100e10df10ce10bd10ac109b108a10491068105710461035443012db3c708100827088561d553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf818a3f2e3b2f003800000000526566756e646564206279206172626974657220766f7465000ee2f400c901fb0002fcf842708042708810246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb001117111911171116111811161115111711151114111611141113111511131112111411121111111311111110111211100f11110f0e11100e10df10ce10bd10ac3132002600000000566f74656420746f20726566756e640020109b108a10491068105706103544030201f85b8168575613917f925612e2f2f481010bf8422c598101014133f40a6fa19401d70030925b6de2814a09216eb3f2f4206ef2d080810101545b0052304133f40c6fa19401d70030925b6de2812583216eb3f2f482009d7321206ef2d080c200f2f42a81010123714133f40c6fa19401d70030925b6de28174c1216eb33402fe9801206ef2d080c0ff923170e2f2f42981010123714133f40c6fa19401d70030925b6de2206ef2d08020c0ff9256159170e292307f98c0009256139170e2e28101017021104f10231025216e955b59f45a3098c801cf004133f442e201913ae30d111711191117111611181116111511171115111411161114111311151113353c02fc1118111911181117111811171116111711161115111611151114111511141113111411131112111311121111111211111110111111100f11100f10ef10de10cd0b0c5509111adb3c1119111a11191118111a11181117111a11171116111a11161115111a11151114111a11141113111a11131112111a11121111111a1111363801f6702093530ab98e732b81010122714133f40c6fa19401d70030925b6de2206eb38e5520206ef2d080c0ff9256179170e292307f9d206ef2d080c0009256159170e2e28e32810101545e0052304133f40c6fa19401d70030925b6de2206eb39820206ef2d080c2009170e298206ef2d08012a0019130e2df9130e2a4370004e83003f41110111a11100f111a0f0e111a0e0d111a0d0c111a0c0b111a0b0a111a0a09111a09111a0807065540db3c7021c200993001111b01a904111a93571c30e2111b206ef2d08001111aa0f842727088103410246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf818ae2f400c901fb00393a3b00ec702093530ab98e6c2b81010122714133f40c6fa19401d70030925b6de2206eb38e4e20206ef2d080c0ff9256179170e292307f9d206ef2d080c0009256159170e2e28e2b810101545e0052304133f40c6fa19401d70030925b6de2206eb397206ef2d080c200923070e29301a401dede9130e2a4e8300036000000004172626974657220726577617264202877696e6e657229001a58cf8680cf8480f400f400cf8101401112111411121111111311111110111211100f11110f0e11100e10df551cdb3c4601fc5b81575a5610f2f48116595613b3935612b39170e2f2f48200d92bf8235610bef2f4536db9917f935354bae28e1356109357127f9b57111110111111107f1111e28e145354bc9357127f9b57111110111111107f1111e2e211171119111711161118111611151117111511141116111411131115111311141111111311113e04de1110111211100f11110f0e11100e10df10ce10bd10ac109b108a107910681057104610354403db3c56148ec1708100827088561d553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb00e30d3f40414300c256118e5c8209312d00727ff82856185618c855208210bfa059865004cb1f12ceca00ca00c9561b553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb00de002c0000000046616c6c6261636b3a20726566756e6465640182708100827088561c553010246d50436d03c8cf8580ca00cf8440ce01fa028069cf40025c6e016eb0935bcf819d58cf8680cf8480f400f400cf81e2f400c901fb0042002c0000000046616c6c6261636b3a2072656c65617365640104db3c4601e48ee8d33f30c8018210aff90f5758cb1fcb3fc91118111a11181117111911171116111811161115111711151114111611141113111511131112111411121111111311111110111211100f11110f0e11100e10df10ce10bd10ac109b108a10791068105710461035443012e05f0f5f0cf2c08245014af84270705003804201503304c8cf8580ca00cf8440ce01fa02806acf40f400c901fb00db3c46013ac87f01ca00111a111911181117111611151114111311121111111055e04700ca01111901111ace01111701ce01111501ce011113fa0201111101cb1f1fca001dca001bca0019ca0017cb1f15cb07c85004fa0212f400f40012f40002c8f40013f40013cb0f13cb0f13cb0f5003fa0213ca0013ca005003fa0213ca0013cb0712cdcdc9ed54b323604e');
|
|
1928
1928
|
const builder = beginCell();
|
|
1929
1929
|
builder.storeUint(0, 1);
|
|
1930
1930
|
initEscrow_init_args({ $$type: 'Escrow_init_args', depositor, beneficiary, deadline, minArbiters, minStake, reputationContract, requireRepCollateral, minRepScore, baseSellerStake })(builder);
|
package/src/utils.ts
CHANGED
|
@@ -1,168 +1,168 @@
|
|
|
1
|
-
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
2
|
-
import { Address, internal, toNano, beginCell } from "@ton/core";
|
|
3
|
-
import { TonClient4 } from "@ton/ton";
|
|
4
|
-
import type { AgentContext } from "@ton-agent-kit/core";
|
|
5
|
-
import {
|
|
6
|
-
Escrow,
|
|
7
|
-
storeDeploy,
|
|
8
|
-
storeDeposit,
|
|
9
|
-
storeRelease,
|
|
10
|
-
storeRefund,
|
|
11
|
-
storeDeliveryConfirmed,
|
|
12
|
-
storeAutoRelease,
|
|
13
|
-
storeOpenDispute,
|
|
14
|
-
storeJoinDispute,
|
|
15
|
-
storeVoteRelease,
|
|
16
|
-
storeVoteRefund,
|
|
17
|
-
storeClaimReward,
|
|
18
|
-
storeFallbackSettle,
|
|
19
|
-
storeSellerStake,
|
|
20
|
-
} from "./contracts/Escrow_Escrow";
|
|
21
|
-
import { sendTransaction } from "@ton-agent-kit/core";
|
|
22
|
-
|
|
23
|
-
const ESCROW_FILE = ".escrow-store.json";
|
|
24
|
-
|
|
25
|
-
export interface EscrowRecord {
|
|
26
|
-
id: string;
|
|
27
|
-
contractAddress: string;
|
|
28
|
-
depositor: string;
|
|
29
|
-
beneficiary: string;
|
|
30
|
-
amount: string;
|
|
31
|
-
deadline: number;
|
|
32
|
-
deadlineISO: string;
|
|
33
|
-
minArbiters: number;
|
|
34
|
-
minStake: string;
|
|
35
|
-
description: string;
|
|
36
|
-
status: string;
|
|
37
|
-
createdAt: string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function loadEscrows(): Record<string, EscrowRecord> {
|
|
41
|
-
try {
|
|
42
|
-
if (existsSync(ESCROW_FILE)) {
|
|
43
|
-
return JSON.parse(readFileSync(ESCROW_FILE, "utf-8"));
|
|
44
|
-
}
|
|
45
|
-
} catch (err: any) {
|
|
46
|
-
console.error(`Failed to load escrow store: ${err.message}`);
|
|
47
|
-
}
|
|
48
|
-
return {};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function saveEscrows(escrows: Record<string, EscrowRecord>): void {
|
|
52
|
-
try {
|
|
53
|
-
writeFileSync(ESCROW_FILE, JSON.stringify(escrows, null, 2), "utf-8");
|
|
54
|
-
} catch (err: any) {
|
|
55
|
-
console.error(`Failed to save escrow store: ${err.message}`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// ── On-chain helpers ──
|
|
60
|
-
|
|
61
|
-
export async function deployEscrowContract(
|
|
62
|
-
agent: AgentContext,
|
|
63
|
-
depositor: Address,
|
|
64
|
-
beneficiary: Address,
|
|
65
|
-
deadline: bigint,
|
|
66
|
-
minArbiters: bigint,
|
|
67
|
-
minStake: bigint,
|
|
68
|
-
reputationContract: Address,
|
|
69
|
-
requireRepCollateral: boolean,
|
|
70
|
-
minRepScore: bigint,
|
|
71
|
-
baseSellerStake: bigint,
|
|
72
|
-
): Promise<Address> {
|
|
73
|
-
const escrow = await Escrow.fromInit(depositor, beneficiary, deadline, minArbiters, minStake, reputationContract, requireRepCollateral, minRepScore, baseSellerStake);
|
|
74
|
-
const deployBody = beginCell()
|
|
75
|
-
.store(storeDeploy({ $$type: "Deploy", queryId: 0n }))
|
|
76
|
-
.endCell();
|
|
77
|
-
|
|
78
|
-
await sendTransaction(agent, [
|
|
79
|
-
internal({
|
|
80
|
-
to: escrow.address,
|
|
81
|
-
value: toNano("0.
|
|
82
|
-
bounce: false,
|
|
83
|
-
init: escrow.init!,
|
|
84
|
-
body: deployBody,
|
|
85
|
-
}),
|
|
86
|
-
]);
|
|
87
|
-
return escrow.address;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export async function depositToContract(agent: AgentContext, contractAddress: Address, amount: string): Promise<void> {
|
|
91
|
-
const body = beginCell().store(storeDeposit({ $$type: "Deposit", queryId: 0n })).endCell();
|
|
92
|
-
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano(amount), bounce: true, body })]);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export async function releaseContract(agent: AgentContext, contractAddress: Address): Promise<void> {
|
|
96
|
-
const body = beginCell().store(storeRelease({ $$type: "Release", queryId: 0n })).endCell();
|
|
97
|
-
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export async function refundContract(agent: AgentContext, contractAddress: Address): Promise<void> {
|
|
101
|
-
const body = beginCell().store(storeRefund({ $$type: "Refund", queryId: 0n })).endCell();
|
|
102
|
-
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export async function confirmDeliveryOnContract(agent: AgentContext, contractAddress: Address, x402TxHash: string): Promise<void> {
|
|
106
|
-
const body = beginCell().store(storeDeliveryConfirmed({ $$type: "DeliveryConfirmed", x402TxHash })).endCell();
|
|
107
|
-
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export async function autoReleaseOnContract(agent: AgentContext, contractAddress: Address): Promise<void> {
|
|
111
|
-
const body = beginCell().store(storeAutoRelease({ $$type: "AutoRelease" })).endCell();
|
|
112
|
-
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export async function openDisputeOnContract(agent: AgentContext, contractAddress: Address): Promise<void> {
|
|
116
|
-
const body = beginCell().store(storeOpenDispute({ $$type: "OpenDispute" })).endCell();
|
|
117
|
-
// 0.
|
|
118
|
-
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export async function joinDisputeOnContract(agent: AgentContext, contractAddress: Address, stakeAmount: string): Promise<void> {
|
|
122
|
-
const body = beginCell().store(storeJoinDispute({ $$type: "JoinDispute" })).endCell();
|
|
123
|
-
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano(stakeAmount), bounce: true, body })]);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export async function voteReleaseOnContract(agent: AgentContext, contractAddress: Address): Promise<void> {
|
|
127
|
-
const body = beginCell().store(storeVoteRelease({ $$type: "VoteRelease" })).endCell();
|
|
128
|
-
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export async function voteRefundOnContract(agent: AgentContext, contractAddress: Address): Promise<void> {
|
|
132
|
-
const body = beginCell().store(storeVoteRefund({ $$type: "VoteRefund" })).endCell();
|
|
133
|
-
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
export async function claimRewardOnContract(agent: AgentContext, contractAddress: Address): Promise<void> {
|
|
137
|
-
const body = beginCell().store(storeClaimReward({ $$type: "ClaimReward" })).endCell();
|
|
138
|
-
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export async function fallbackSettleOnContract(agent: AgentContext, contractAddress: Address): Promise<void> {
|
|
142
|
-
const body = beginCell().store(storeFallbackSettle({ $$type: "FallbackSettle" })).endCell();
|
|
143
|
-
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export async function sellerStakeOnContract(agent: AgentContext, contractAddress: Address, stakeAmount: string): Promise<void> {
|
|
147
|
-
const body = beginCell().store(storeSellerStake({ $$type: "SellerStake" })).endCell();
|
|
148
|
-
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano(stakeAmount), bounce: true, body })]);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export async function getContractState(agent: AgentContext, contractAddress: Address) {
|
|
152
|
-
const client = new TonClient4({ endpoint: agent.rpcUrl });
|
|
153
|
-
const contract = client.open(Escrow.fromAddress(contractAddress));
|
|
154
|
-
const data = await contract.getEscrowData();
|
|
155
|
-
const balance = await contract.getBalance();
|
|
156
|
-
return { ...data, balance };
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export async function getLatestTxHash(address: string, network: "testnet" | "mainnet"): Promise<string> {
|
|
160
|
-
const apiBase = network === "testnet" ? "https://testnet.tonapi.io/v2" : "https://tonapi.io/v2";
|
|
161
|
-
try {
|
|
162
|
-
const res = await fetch(`${apiBase}/accounts/${encodeURIComponent(address)}/events?limit=1`);
|
|
163
|
-
const data = await res.json();
|
|
164
|
-
return data.events?.[0]?.event_id || "pending";
|
|
165
|
-
} catch {
|
|
166
|
-
return "pending";
|
|
167
|
-
}
|
|
168
|
-
}
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
2
|
+
import { Address, internal, toNano, beginCell } from "@ton/core";
|
|
3
|
+
import { TonClient4 } from "@ton/ton";
|
|
4
|
+
import type { AgentContext } from "@ton-agent-kit/core";
|
|
5
|
+
import {
|
|
6
|
+
Escrow,
|
|
7
|
+
storeDeploy,
|
|
8
|
+
storeDeposit,
|
|
9
|
+
storeRelease,
|
|
10
|
+
storeRefund,
|
|
11
|
+
storeDeliveryConfirmed,
|
|
12
|
+
storeAutoRelease,
|
|
13
|
+
storeOpenDispute,
|
|
14
|
+
storeJoinDispute,
|
|
15
|
+
storeVoteRelease,
|
|
16
|
+
storeVoteRefund,
|
|
17
|
+
storeClaimReward,
|
|
18
|
+
storeFallbackSettle,
|
|
19
|
+
storeSellerStake,
|
|
20
|
+
} from "./contracts/Escrow_Escrow";
|
|
21
|
+
import { sendTransaction } from "@ton-agent-kit/core";
|
|
22
|
+
|
|
23
|
+
const ESCROW_FILE = ".escrow-store.json";
|
|
24
|
+
|
|
25
|
+
export interface EscrowRecord {
|
|
26
|
+
id: string;
|
|
27
|
+
contractAddress: string;
|
|
28
|
+
depositor: string;
|
|
29
|
+
beneficiary: string;
|
|
30
|
+
amount: string;
|
|
31
|
+
deadline: number;
|
|
32
|
+
deadlineISO: string;
|
|
33
|
+
minArbiters: number;
|
|
34
|
+
minStake: string;
|
|
35
|
+
description: string;
|
|
36
|
+
status: string;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function loadEscrows(): Record<string, EscrowRecord> {
|
|
41
|
+
try {
|
|
42
|
+
if (existsSync(ESCROW_FILE)) {
|
|
43
|
+
return JSON.parse(readFileSync(ESCROW_FILE, "utf-8"));
|
|
44
|
+
}
|
|
45
|
+
} catch (err: any) {
|
|
46
|
+
console.error(`Failed to load escrow store: ${err.message}`);
|
|
47
|
+
}
|
|
48
|
+
return {};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function saveEscrows(escrows: Record<string, EscrowRecord>): void {
|
|
52
|
+
try {
|
|
53
|
+
writeFileSync(ESCROW_FILE, JSON.stringify(escrows, null, 2), "utf-8");
|
|
54
|
+
} catch (err: any) {
|
|
55
|
+
console.error(`Failed to save escrow store: ${err.message}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// ── On-chain helpers ──
|
|
60
|
+
|
|
61
|
+
export async function deployEscrowContract(
|
|
62
|
+
agent: AgentContext,
|
|
63
|
+
depositor: Address,
|
|
64
|
+
beneficiary: Address,
|
|
65
|
+
deadline: bigint,
|
|
66
|
+
minArbiters: bigint,
|
|
67
|
+
minStake: bigint,
|
|
68
|
+
reputationContract: Address,
|
|
69
|
+
requireRepCollateral: boolean,
|
|
70
|
+
minRepScore: bigint,
|
|
71
|
+
baseSellerStake: bigint,
|
|
72
|
+
): Promise<Address> {
|
|
73
|
+
const escrow = await Escrow.fromInit(depositor, beneficiary, deadline, minArbiters, minStake, reputationContract, requireRepCollateral, minRepScore, baseSellerStake);
|
|
74
|
+
const deployBody = beginCell()
|
|
75
|
+
.store(storeDeploy({ $$type: "Deploy", queryId: 0n }))
|
|
76
|
+
.endCell();
|
|
77
|
+
|
|
78
|
+
await sendTransaction(agent, [
|
|
79
|
+
internal({
|
|
80
|
+
to: escrow.address,
|
|
81
|
+
value: toNano("0.12"),
|
|
82
|
+
bounce: false,
|
|
83
|
+
init: escrow.init!,
|
|
84
|
+
body: deployBody,
|
|
85
|
+
}),
|
|
86
|
+
]);
|
|
87
|
+
return escrow.address;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export async function depositToContract(agent: AgentContext, contractAddress: Address, amount: string): Promise<void> {
|
|
91
|
+
const body = beginCell().store(storeDeposit({ $$type: "Deposit", queryId: 0n })).endCell();
|
|
92
|
+
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano(amount), bounce: true, body })]);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export async function releaseContract(agent: AgentContext, contractAddress: Address): Promise<void> {
|
|
96
|
+
const body = beginCell().store(storeRelease({ $$type: "Release", queryId: 0n })).endCell();
|
|
97
|
+
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.12"), bounce: true, body })]);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export async function refundContract(agent: AgentContext, contractAddress: Address): Promise<void> {
|
|
101
|
+
const body = beginCell().store(storeRefund({ $$type: "Refund", queryId: 0n })).endCell();
|
|
102
|
+
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.12"), bounce: true, body })]);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export async function confirmDeliveryOnContract(agent: AgentContext, contractAddress: Address, x402TxHash: string): Promise<void> {
|
|
106
|
+
const body = beginCell().store(storeDeliveryConfirmed({ $$type: "DeliveryConfirmed", x402TxHash })).endCell();
|
|
107
|
+
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.12"), bounce: true, body })]);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export async function autoReleaseOnContract(agent: AgentContext, contractAddress: Address): Promise<void> {
|
|
111
|
+
const body = beginCell().store(storeAutoRelease({ $$type: "AutoRelease" })).endCell();
|
|
112
|
+
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.12"), bounce: true, body })]);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export async function openDisputeOnContract(agent: AgentContext, contractAddress: Address): Promise<void> {
|
|
116
|
+
const body = beginCell().store(storeOpenDispute({ $$type: "OpenDispute" })).endCell();
|
|
117
|
+
// 0.15 TON: escrow gas + cross-contract notification to reputation. Excess refunded.
|
|
118
|
+
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.15"), bounce: true, body })]);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export async function joinDisputeOnContract(agent: AgentContext, contractAddress: Address, stakeAmount: string): Promise<void> {
|
|
122
|
+
const body = beginCell().store(storeJoinDispute({ $$type: "JoinDispute" })).endCell();
|
|
123
|
+
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano(stakeAmount), bounce: true, body })]);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export async function voteReleaseOnContract(agent: AgentContext, contractAddress: Address): Promise<void> {
|
|
127
|
+
const body = beginCell().store(storeVoteRelease({ $$type: "VoteRelease" })).endCell();
|
|
128
|
+
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.12"), bounce: true, body })]);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export async function voteRefundOnContract(agent: AgentContext, contractAddress: Address): Promise<void> {
|
|
132
|
+
const body = beginCell().store(storeVoteRefund({ $$type: "VoteRefund" })).endCell();
|
|
133
|
+
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.12"), bounce: true, body })]);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export async function claimRewardOnContract(agent: AgentContext, contractAddress: Address): Promise<void> {
|
|
137
|
+
const body = beginCell().store(storeClaimReward({ $$type: "ClaimReward" })).endCell();
|
|
138
|
+
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.12"), bounce: true, body })]);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export async function fallbackSettleOnContract(agent: AgentContext, contractAddress: Address): Promise<void> {
|
|
142
|
+
const body = beginCell().store(storeFallbackSettle({ $$type: "FallbackSettle" })).endCell();
|
|
143
|
+
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano("0.12"), bounce: true, body })]);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export async function sellerStakeOnContract(agent: AgentContext, contractAddress: Address, stakeAmount: string): Promise<void> {
|
|
147
|
+
const body = beginCell().store(storeSellerStake({ $$type: "SellerStake" })).endCell();
|
|
148
|
+
await sendTransaction(agent, [internal({ to: contractAddress, value: toNano(stakeAmount), bounce: true, body })]);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export async function getContractState(agent: AgentContext, contractAddress: Address) {
|
|
152
|
+
const client = new TonClient4({ endpoint: agent.rpcUrl });
|
|
153
|
+
const contract = client.open(Escrow.fromAddress(contractAddress));
|
|
154
|
+
const data = await contract.getEscrowData();
|
|
155
|
+
const balance = await contract.getBalance();
|
|
156
|
+
return { ...data, balance };
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export async function getLatestTxHash(address: string, network: "testnet" | "mainnet"): Promise<string> {
|
|
160
|
+
const apiBase = network === "testnet" ? "https://testnet.tonapi.io/v2" : "https://tonapi.io/v2";
|
|
161
|
+
try {
|
|
162
|
+
const res = await fetch(`${apiBase}/accounts/${encodeURIComponent(address)}/events?limit=1`);
|
|
163
|
+
const data = await res.json();
|
|
164
|
+
return data.events?.[0]?.event_id || "pending";
|
|
165
|
+
} catch {
|
|
166
|
+
return "pending";
|
|
167
|
+
}
|
|
168
|
+
}
|