@layerzerolabs/ton-sdk-tools 3.0.75-test.0 → 3.0.75
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/CHANGELOG.md +6 -0
- package/dist/index.cjs +16 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +16 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -345,7 +345,7 @@ function parseClasses(strInput) {
|
|
|
345
345
|
}
|
|
346
346
|
return results;
|
|
347
347
|
}
|
|
348
|
-
function saveBaseEventHandler(directory) {
|
|
348
|
+
function saveBaseEventHandler(directory, opcodesImportPath = "../constants", allTypesImportPath = "./allTypes", tonObjectUnwrapperImportPath = "./TonObjectUnwrapper", tonContractWrapperImportPath = "./TonContractWrapper") {
|
|
349
349
|
const allTypes = ["ExtendedContract", "ActionEvent", "Md", "nameMap"].sort();
|
|
350
350
|
const savedCode = `${file_signature_header}
|
|
351
351
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
@@ -355,13 +355,13 @@ import { Cell, Transaction, TransactionComputeVm, TransactionDescriptionGeneric,
|
|
|
355
355
|
import { BlockchainTransaction, EventMessageSent, SendMessageResult } from '@ton/sandbox'
|
|
356
356
|
import { flattenTransaction } from '@ton/test-utils'
|
|
357
357
|
|
|
358
|
-
import { OPCODES } from '
|
|
358
|
+
import { OPCODES } from '${opcodesImportPath}'
|
|
359
359
|
|
|
360
360
|
import { getLzDict,
|
|
361
|
-
${allTypes.map((type) => " " + type + ",\n").join("")}} from '
|
|
361
|
+
${allTypes.map((type) => " " + type + ",\n").join("")}} from '${allTypesImportPath}'
|
|
362
362
|
|
|
363
|
-
import { TonObjectUnwrapper } from '
|
|
364
|
-
import { TonContractWrapper } from '
|
|
363
|
+
import { TonObjectUnwrapper } from '${tonObjectUnwrapperImportPath}'
|
|
364
|
+
import { TonContractWrapper } from '${tonContractWrapperImportPath}'
|
|
365
365
|
|
|
366
366
|
export class LzEvent {
|
|
367
367
|
private _eventPromise: Promise<ActionEvent>
|
|
@@ -455,7 +455,7 @@ export class BaseEventHandler {
|
|
|
455
455
|
`;
|
|
456
456
|
fs__namespace.writeFileSync(path__namespace.join(directory, "BaseEventHandler.ts"), savedCode);
|
|
457
457
|
}
|
|
458
|
-
function saveLzEventHandler(directory) {
|
|
458
|
+
function saveLzEventHandler(directory, allTypesImportPath = "./allTypes", baseEventHandlerImportPath = "./BaseEventHandler") {
|
|
459
459
|
const savedCode = `${file_signature_header}
|
|
460
460
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
461
461
|
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
@@ -463,8 +463,8 @@ function saveLzEventHandler(directory) {
|
|
|
463
463
|
import { Cell, Transaction } from '@ton/core'
|
|
464
464
|
import { BlockchainTransaction, EventMessageSent, SendMessageResult } from '@ton/sandbox'
|
|
465
465
|
|
|
466
|
-
import { Md, MdPacketSent } from '
|
|
467
|
-
import { BaseEventHandler, LzEvent } from '
|
|
466
|
+
import { Md, MdPacketSent } from '${allTypesImportPath}'
|
|
467
|
+
import { BaseEventHandler, LzEvent } from '${baseEventHandlerImportPath}'
|
|
468
468
|
|
|
469
469
|
export class LzEventHandler extends BaseEventHandler {
|
|
470
470
|
public allVictories = {
|
|
@@ -659,7 +659,7 @@ export class ClasslibWrapper extends BaseWrapper {
|
|
|
659
659
|
`;
|
|
660
660
|
fs__namespace.writeFileSync(path__namespace.join(directory, "ClasslibWrapper.ts"), savedCode);
|
|
661
661
|
}
|
|
662
|
-
function saveTonContractWrapper(tonObjects, directory) {
|
|
662
|
+
function saveTonContractWrapper(tonObjects, directory, classlibWrapperImportPath = "./ClasslibWrapper") {
|
|
663
663
|
const generatedMethods = Object.entries(tonObjects).map(([_, tonObject]) => tonObject.constructorCode ?? "").join("\n");
|
|
664
664
|
const savedCode = `${file_signature_header}
|
|
665
665
|
|
|
@@ -676,7 +676,7 @@ import {
|
|
|
676
676
|
beginCell,
|
|
677
677
|
} from '@ton/core'
|
|
678
678
|
|
|
679
|
-
import { ClasslibWrapper } from '
|
|
679
|
+
import { ClasslibWrapper } from '${classlibWrapperImportPath}'
|
|
680
680
|
|
|
681
681
|
export class TonContractWrapper extends ClasslibWrapper {
|
|
682
682
|
static create(code: Cell, data: Cell, workchain = 0): TonContractWrapper {
|
|
@@ -699,7 +699,7 @@ export class TonContractWrapper extends ClasslibWrapper {
|
|
|
699
699
|
`;
|
|
700
700
|
fs__namespace.writeFileSync(path__namespace.join(directory, "TonContractWrapper.ts"), savedCode);
|
|
701
701
|
}
|
|
702
|
-
function saveAllTypes(tonObjects, directory) {
|
|
702
|
+
function saveAllTypes(tonObjects, directory, tonContractWrapperImportPath = "./TonContractWrapper") {
|
|
703
703
|
const generatedTypes = Object.entries(tonObjects).filter(([_, tonObject]) => tonObject.attributes.length > 0).map(([_, tonObject]) => "export " + (tonObject.tsTypeCode ?? "")).join("");
|
|
704
704
|
const mapping = {};
|
|
705
705
|
const keyMapping = {};
|
|
@@ -728,7 +728,7 @@ function saveAllTypes(tonObjects, directory) {
|
|
|
728
728
|
import { Cell, OpenedContract, beginCell } from '@ton/core'
|
|
729
729
|
import { SandboxContract } from '@ton/sandbox'
|
|
730
730
|
|
|
731
|
-
import { TonContractWrapper } from '
|
|
731
|
+
import { TonContractWrapper } from '${tonContractWrapperImportPath}'
|
|
732
732
|
|
|
733
733
|
export type ExtendedContract<T> = SandboxContract<T> | OpenedContract<T>
|
|
734
734
|
|
|
@@ -773,8 +773,7 @@ ${generatedNameMaps}
|
|
|
773
773
|
`;
|
|
774
774
|
fs__namespace.writeFileSync(path__namespace.join(directory, "allTypes.ts"), savedCode);
|
|
775
775
|
}
|
|
776
|
-
function saveLzGasTracker(directory, opcodesImportPath) {
|
|
777
|
-
opcodesImportPath = opcodesImportPath ?? "../constants";
|
|
776
|
+
function saveLzGasTracker(directory, opcodesImportPath = "../constants") {
|
|
778
777
|
const savedCode = `${file_signature_header}
|
|
779
778
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
780
779
|
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
@@ -904,7 +903,7 @@ export class LzGasTracker {
|
|
|
904
903
|
}`;
|
|
905
904
|
fs__namespace.writeFileSync(path__namespace.join(directory, "LzGasTracker.ts"), savedCode);
|
|
906
905
|
}
|
|
907
|
-
function saveTonObjectUnwrapper(tonObjects, directory) {
|
|
906
|
+
function saveTonObjectUnwrapper(tonObjects, directory, allTypesImportPath = "./allTypes", tonContractWrapperImportPath = "./TonContractWrapper") {
|
|
908
907
|
const allTypes = [
|
|
909
908
|
...Object.values(tonObjects).map((obj) => obj.tsTypeName).filter((name) => name !== void 0),
|
|
910
909
|
"ExtendedContract",
|
|
@@ -920,11 +919,9 @@ import { Cell, Transaction, TransactionComputeVm, TransactionDescriptionGeneric,
|
|
|
920
919
|
import { BlockchainTransaction, EventMessageSent, SendMessageResult } from '@ton/sandbox'
|
|
921
920
|
import { flattenTransaction } from '@ton/test-utils'
|
|
922
921
|
|
|
923
|
-
import { OPCODES } from '../constants'
|
|
924
|
-
|
|
925
922
|
import { getLzDict,
|
|
926
|
-
${allTypes.map((type) => " " + type + ",\n").join("")}} from '
|
|
927
|
-
import { TonContractWrapper } from '
|
|
923
|
+
${allTypes.map((type) => " " + type + ",\n").join("")}} from '${allTypesImportPath}'
|
|
924
|
+
import { TonContractWrapper } from '${tonContractWrapperImportPath}'
|
|
928
925
|
|
|
929
926
|
export class TonObjectUnwrapper {
|
|
930
927
|
static async getTypeOf(provider: ExtendedContract<TonContractWrapper>, obj_cell: Cell): Promise<string> {
|