@tonappchain/sdk 0.7.0-rc24-test-10 → 0.7.0-rc24-test-12
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.
|
@@ -53,14 +53,10 @@ class AbiHandler {
|
|
|
53
53
|
if (!func.name || !Array.isArray(func.inputs)) {
|
|
54
54
|
return null;
|
|
55
55
|
}
|
|
56
|
-
// Build parameter list
|
|
56
|
+
// Build parameter list with proper tuple handling
|
|
57
57
|
const params = func.inputs
|
|
58
58
|
.map((input) => {
|
|
59
|
-
let paramType = input
|
|
60
|
-
// Handle array types
|
|
61
|
-
if (input.type.includes('[]')) {
|
|
62
|
-
paramType = input.type;
|
|
63
|
-
}
|
|
59
|
+
let paramType = this._buildParameterType(input);
|
|
64
60
|
// Add parameter name if available
|
|
65
61
|
if (input.name) {
|
|
66
62
|
return `${paramType} ${input.name}`;
|
|
@@ -73,19 +69,14 @@ class AbiHandler {
|
|
|
73
69
|
if (func.outputs && func.outputs.length > 0) {
|
|
74
70
|
const outputs = func.outputs
|
|
75
71
|
.map((output) => {
|
|
76
|
-
const outputType = output
|
|
72
|
+
const outputType = this._buildParameterType(output);
|
|
77
73
|
if (output.name) {
|
|
78
74
|
return `${outputType} ${output.name}`;
|
|
79
75
|
}
|
|
80
76
|
return outputType;
|
|
81
77
|
})
|
|
82
78
|
.join(', ');
|
|
83
|
-
|
|
84
|
-
returnTypes = ` returns (${outputs})`;
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
returnTypes = ` returns (${outputs})`;
|
|
88
|
-
}
|
|
79
|
+
returnTypes = ` returns (${outputs})`;
|
|
89
80
|
}
|
|
90
81
|
// Build full signature
|
|
91
82
|
const stateMutability = func.stateMutability || 'nonpayable';
|
|
@@ -101,5 +92,32 @@ class AbiHandler {
|
|
|
101
92
|
}
|
|
102
93
|
return `function ${func.name}(${params})${mutabilityKeyword} external${returnTypes}`;
|
|
103
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Build parameter type string, handling tuples/structs properly
|
|
97
|
+
*/
|
|
98
|
+
_buildParameterType(param) {
|
|
99
|
+
if (param.type === 'tuple') {
|
|
100
|
+
// Handle struct/tuple types
|
|
101
|
+
if (param.components && Array.isArray(param.components)) {
|
|
102
|
+
const componentTypes = param.components
|
|
103
|
+
.map((component) => this._buildParameterType(component))
|
|
104
|
+
.join(',');
|
|
105
|
+
return `(${componentTypes})`;
|
|
106
|
+
}
|
|
107
|
+
return 'tuple'; // fallback
|
|
108
|
+
}
|
|
109
|
+
if (param.type === 'tuple[]') {
|
|
110
|
+
// Handle array of structs
|
|
111
|
+
if (param.components && Array.isArray(param.components)) {
|
|
112
|
+
const componentTypes = param.components
|
|
113
|
+
.map((component) => this._buildParameterType(component))
|
|
114
|
+
.join(',');
|
|
115
|
+
return `(${componentTypes})[]`;
|
|
116
|
+
}
|
|
117
|
+
return 'tuple[]'; // fallback
|
|
118
|
+
}
|
|
119
|
+
// Handle regular types and arrays
|
|
120
|
+
return param.type;
|
|
121
|
+
}
|
|
104
122
|
}
|
|
105
123
|
exports.AbiHandler = AbiHandler;
|
|
@@ -46,7 +46,7 @@ class Simulator {
|
|
|
46
46
|
};
|
|
47
47
|
const simulation = await this.operationTracker.simulateTACMessage(tacSimulationParams);
|
|
48
48
|
this.logger.debug(`TAC simulation ${simulation.simulationStatus ? 'success' : 'failed'}`);
|
|
49
|
-
const isRoundTrip = options.isRoundTrip ?? assets.length !== 0;
|
|
49
|
+
const isRoundTrip = options.isRoundTrip ?? (assets.length !== 0 || simulation.outMessages?.length !== 0);
|
|
50
50
|
const CrossChainLayerC = this.config.artifacts.ton.wrappers.CrossChainLayer;
|
|
51
51
|
const crossChainLayer = this.config.TONParams.contractOpener.open(CrossChainLayerC.createFromAddress(ton_1.Address.parse(this.config.TONParams.crossChainLayerAddress)));
|
|
52
52
|
const fullStateCCL = await crossChainLayer.getFullData();
|
|
@@ -56,7 +56,7 @@ class TACTransactionManager {
|
|
|
56
56
|
}
|
|
57
57
|
// Approve all assets
|
|
58
58
|
const crossChainLayerAddress = await this.config.TACParams.crossChainLayer.getAddress();
|
|
59
|
-
|
|
59
|
+
assets.map(async (asset) => await this.approveAsset(asset, signer, crossChainLayerAddress));
|
|
60
60
|
const protocolFee = await this.config.TACParams.crossChainLayer.getProtocolFee();
|
|
61
61
|
const shardsKey = BigInt(Math.round(Math.random() * 1e18));
|
|
62
62
|
this.logger.debug(`Shards key: ${shardsKey}, Protocol fee: ${protocolFee}`);
|