@galaxy-kj/core-stellar-sdk 2.0.0
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/LICENSE +21 -0
- package/README.md +576 -0
- package/dist/claimable-balances/claimable-balance-manager.d.ts +99 -0
- package/dist/claimable-balances/claimable-balance-manager.d.ts.map +1 -0
- package/dist/claimable-balances/claimable-balance-manager.js +352 -0
- package/dist/claimable-balances/claimable-balance-manager.js.map +1 -0
- package/dist/claimable-balances/helpers.d.ts +66 -0
- package/dist/claimable-balances/helpers.d.ts.map +1 -0
- package/dist/claimable-balances/helpers.js +179 -0
- package/dist/claimable-balances/helpers.js.map +1 -0
- package/dist/claimable-balances/index.d.ts +12 -0
- package/dist/claimable-balances/index.d.ts.map +1 -0
- package/dist/claimable-balances/index.js +14 -0
- package/dist/claimable-balances/index.js.map +1 -0
- package/dist/claimable-balances/predicate-builder.d.ts +66 -0
- package/dist/claimable-balances/predicate-builder.d.ts.map +1 -0
- package/dist/claimable-balances/predicate-builder.js +169 -0
- package/dist/claimable-balances/predicate-builder.js.map +1 -0
- package/dist/claimable-balances/types.d.ts +123 -0
- package/dist/claimable-balances/types.d.ts.map +1 -0
- package/dist/claimable-balances/types.js +9 -0
- package/dist/claimable-balances/types.js.map +1 -0
- package/dist/hooks/use-stellar.d.ts +48 -0
- package/dist/hooks/use-stellar.d.ts.map +1 -0
- package/dist/hooks/use-stellar.js +510 -0
- package/dist/hooks/use-stellar.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/liquidity-pools/calculations.d.ts +113 -0
- package/dist/liquidity-pools/calculations.d.ts.map +1 -0
- package/dist/liquidity-pools/calculations.js +291 -0
- package/dist/liquidity-pools/calculations.js.map +1 -0
- package/dist/liquidity-pools/helpers.d.ts +102 -0
- package/dist/liquidity-pools/helpers.d.ts.map +1 -0
- package/dist/liquidity-pools/helpers.js +219 -0
- package/dist/liquidity-pools/helpers.js.map +1 -0
- package/dist/liquidity-pools/index.d.ts +13 -0
- package/dist/liquidity-pools/index.d.ts.map +1 -0
- package/dist/liquidity-pools/index.js +18 -0
- package/dist/liquidity-pools/index.js.map +1 -0
- package/dist/liquidity-pools/liquidity-pool-manager.d.ts +106 -0
- package/dist/liquidity-pools/liquidity-pool-manager.d.ts.map +1 -0
- package/dist/liquidity-pools/liquidity-pool-manager.js +387 -0
- package/dist/liquidity-pools/liquidity-pool-manager.js.map +1 -0
- package/dist/liquidity-pools/types.d.ts +135 -0
- package/dist/liquidity-pools/types.d.ts.map +1 -0
- package/dist/liquidity-pools/types.js +6 -0
- package/dist/liquidity-pools/types.js.map +1 -0
- package/dist/liquidity-pools/validation.d.ts +75 -0
- package/dist/liquidity-pools/validation.d.ts.map +1 -0
- package/dist/liquidity-pools/validation.js +218 -0
- package/dist/liquidity-pools/validation.js.map +1 -0
- package/dist/services/stellar-service.d.ts +231 -0
- package/dist/services/stellar-service.d.ts.map +1 -0
- package/dist/services/stellar-service.js +674 -0
- package/dist/services/stellar-service.js.map +1 -0
- package/dist/soroban/helpers/contract-factory.d.ts +45 -0
- package/dist/soroban/helpers/contract-factory.d.ts.map +1 -0
- package/dist/soroban/helpers/contract-factory.js +84 -0
- package/dist/soroban/helpers/contract-factory.js.map +1 -0
- package/dist/soroban/helpers/token-contract-wrapper.d.ts +104 -0
- package/dist/soroban/helpers/token-contract-wrapper.d.ts.map +1 -0
- package/dist/soroban/helpers/token-contract-wrapper.js +286 -0
- package/dist/soroban/helpers/token-contract-wrapper.js.map +1 -0
- package/dist/soroban/index.d.ts +19 -0
- package/dist/soroban/index.d.ts.map +1 -0
- package/dist/soroban/index.js +19 -0
- package/dist/soroban/index.js.map +1 -0
- package/dist/soroban/soroban-contract-manager.d.ts +71 -0
- package/dist/soroban/soroban-contract-manager.d.ts.map +1 -0
- package/dist/soroban/soroban-contract-manager.js +376 -0
- package/dist/soroban/soroban-contract-manager.js.map +1 -0
- package/dist/soroban/types/contract-types.d.ts +156 -0
- package/dist/soroban/types/contract-types.d.ts.map +1 -0
- package/dist/soroban/types/contract-types.js +3 -0
- package/dist/soroban/types/contract-types.js.map +1 -0
- package/dist/soroban/utils/abi-parser.d.ts +90 -0
- package/dist/soroban/utils/abi-parser.d.ts.map +1 -0
- package/dist/soroban/utils/abi-parser.js +308 -0
- package/dist/soroban/utils/abi-parser.js.map +1 -0
- package/dist/soroban/utils/error-parser.d.ts +70 -0
- package/dist/soroban/utils/error-parser.d.ts.map +1 -0
- package/dist/soroban/utils/error-parser.js +302 -0
- package/dist/soroban/utils/error-parser.js.map +1 -0
- package/dist/soroban/utils/event-decoder.d.ts +91 -0
- package/dist/soroban/utils/event-decoder.d.ts.map +1 -0
- package/dist/soroban/utils/event-decoder.js +307 -0
- package/dist/soroban/utils/event-decoder.js.map +1 -0
- package/dist/soroban/utils/event-monitor.d.ts +93 -0
- package/dist/soroban/utils/event-monitor.d.ts.map +1 -0
- package/dist/soroban/utils/event-monitor.js +282 -0
- package/dist/soroban/utils/event-monitor.js.map +1 -0
- package/dist/soroban/utils/function-signature-builder.d.ts +98 -0
- package/dist/soroban/utils/function-signature-builder.d.ts.map +1 -0
- package/dist/soroban/utils/function-signature-builder.js +272 -0
- package/dist/soroban/utils/function-signature-builder.js.map +1 -0
- package/dist/soroban/utils/scval-converter.d.ts +48 -0
- package/dist/soroban/utils/scval-converter.d.ts.map +1 -0
- package/dist/soroban/utils/scval-converter.js +320 -0
- package/dist/soroban/utils/scval-converter.js.map +1 -0
- package/dist/sponsored-reserves/builders/sponsored-account-builder.d.ts +58 -0
- package/dist/sponsored-reserves/builders/sponsored-account-builder.d.ts.map +1 -0
- package/dist/sponsored-reserves/builders/sponsored-account-builder.js +159 -0
- package/dist/sponsored-reserves/builders/sponsored-account-builder.js.map +1 -0
- package/dist/sponsored-reserves/builders/sponsored-claimable-balance-builder.d.ts +104 -0
- package/dist/sponsored-reserves/builders/sponsored-claimable-balance-builder.d.ts.map +1 -0
- package/dist/sponsored-reserves/builders/sponsored-claimable-balance-builder.js +258 -0
- package/dist/sponsored-reserves/builders/sponsored-claimable-balance-builder.js.map +1 -0
- package/dist/sponsored-reserves/builders/sponsored-data-entry-builder.d.ts +96 -0
- package/dist/sponsored-reserves/builders/sponsored-data-entry-builder.d.ts.map +1 -0
- package/dist/sponsored-reserves/builders/sponsored-data-entry-builder.js +320 -0
- package/dist/sponsored-reserves/builders/sponsored-data-entry-builder.js.map +1 -0
- package/dist/sponsored-reserves/builders/sponsored-signer-builder.d.ts +100 -0
- package/dist/sponsored-reserves/builders/sponsored-signer-builder.d.ts.map +1 -0
- package/dist/sponsored-reserves/builders/sponsored-signer-builder.js +271 -0
- package/dist/sponsored-reserves/builders/sponsored-signer-builder.js.map +1 -0
- package/dist/sponsored-reserves/builders/sponsored-trustline-builder.d.ts +87 -0
- package/dist/sponsored-reserves/builders/sponsored-trustline-builder.d.ts.map +1 -0
- package/dist/sponsored-reserves/builders/sponsored-trustline-builder.js +281 -0
- package/dist/sponsored-reserves/builders/sponsored-trustline-builder.js.map +1 -0
- package/dist/sponsored-reserves/index.d.ts +20 -0
- package/dist/sponsored-reserves/index.d.ts.map +1 -0
- package/dist/sponsored-reserves/index.js +24 -0
- package/dist/sponsored-reserves/index.js.map +1 -0
- package/dist/sponsored-reserves/services/sponsored-reserves-manager.d.ts +144 -0
- package/dist/sponsored-reserves/services/sponsored-reserves-manager.d.ts.map +1 -0
- package/dist/sponsored-reserves/services/sponsored-reserves-manager.js +536 -0
- package/dist/sponsored-reserves/services/sponsored-reserves-manager.js.map +1 -0
- package/dist/sponsored-reserves/templates/claimable-balance-template.d.ts +96 -0
- package/dist/sponsored-reserves/templates/claimable-balance-template.d.ts.map +1 -0
- package/dist/sponsored-reserves/templates/claimable-balance-template.js +306 -0
- package/dist/sponsored-reserves/templates/claimable-balance-template.js.map +1 -0
- package/dist/sponsored-reserves/templates/multi-operation-template.d.ts +99 -0
- package/dist/sponsored-reserves/templates/multi-operation-template.d.ts.map +1 -0
- package/dist/sponsored-reserves/templates/multi-operation-template.js +313 -0
- package/dist/sponsored-reserves/templates/multi-operation-template.js.map +1 -0
- package/dist/sponsored-reserves/templates/user-onboarding-template.d.ts +79 -0
- package/dist/sponsored-reserves/templates/user-onboarding-template.d.ts.map +1 -0
- package/dist/sponsored-reserves/templates/user-onboarding-template.js +262 -0
- package/dist/sponsored-reserves/templates/user-onboarding-template.js.map +1 -0
- package/dist/sponsored-reserves/types/sponsored-reserves-types.d.ts +364 -0
- package/dist/sponsored-reserves/types/sponsored-reserves-types.d.ts.map +1 -0
- package/dist/sponsored-reserves/types/sponsored-reserves-types.js +9 -0
- package/dist/sponsored-reserves/types/sponsored-reserves-types.js.map +1 -0
- package/dist/sponsored-reserves/utils/cost-calculator.d.ts +98 -0
- package/dist/sponsored-reserves/utils/cost-calculator.d.ts.map +1 -0
- package/dist/sponsored-reserves/utils/cost-calculator.js +238 -0
- package/dist/sponsored-reserves/utils/cost-calculator.js.map +1 -0
- package/dist/sponsored-reserves/utils/sponsorship-validation.d.ts +112 -0
- package/dist/sponsored-reserves/utils/sponsorship-validation.d.ts.map +1 -0
- package/dist/sponsored-reserves/utils/sponsorship-validation.js +394 -0
- package/dist/sponsored-reserves/utils/sponsorship-validation.js.map +1 -0
- package/dist/types/stellar-sdk-compat.d.ts +25 -0
- package/dist/types/stellar-sdk-compat.d.ts.map +1 -0
- package/dist/types/stellar-sdk-compat.js +44 -0
- package/dist/types/stellar-sdk-compat.js.map +1 -0
- package/dist/types/stellar-types.d.ts +160 -0
- package/dist/types/stellar-types.d.ts.map +1 -0
- package/dist/types/stellar-types.js +9 -0
- package/dist/types/stellar-types.js.map +1 -0
- package/dist/utils/encryption.utils.d.ts +9 -0
- package/dist/utils/encryption.utils.d.ts.map +1 -0
- package/dist/utils/encryption.utils.js +44 -0
- package/dist/utils/encryption.utils.js.map +1 -0
- package/dist/utils/network-utils.d.ts +138 -0
- package/dist/utils/network-utils.d.ts.map +1 -0
- package/dist/utils/network-utils.js +240 -0
- package/dist/utils/network-utils.js.map +1 -0
- package/dist/utils/stellar-utils.d.ts +114 -0
- package/dist/utils/stellar-utils.d.ts.map +1 -0
- package/dist/utils/stellar-utils.js +186 -0
- package/dist/utils/stellar-utils.js.map +1 -0
- package/dist/utils/supabase-client.d.ts +2 -0
- package/dist/utils/supabase-client.d.ts.map +1 -0
- package/dist/utils/supabase-client.js +9 -0
- package/dist/utils/supabase-client.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Soroban Contract Manager
|
|
3
|
+
* @description Main class for Soroban contract operations
|
|
4
|
+
* @author Galaxy DevKit Team
|
|
5
|
+
* @version 1.0.0
|
|
6
|
+
* @since 2024-12-01
|
|
7
|
+
* @note Type checking disabled due to Stellar SDK v14 compatibility issues
|
|
8
|
+
*/
|
|
9
|
+
import { SorobanRpc } from '@stellar/stellar-sdk';
|
|
10
|
+
import { ContractDeploymentParams, ContractInvocationParams, ContractStateQueryParams, ContractEventQueryParams, ContractDeploymentResult, InvocationResult, SimulationResult, ContractEventDetail, ContractUpgradeParams, ContractUpgradeResult } from '../types/contract-types';
|
|
11
|
+
export declare class SorobanContractManager {
|
|
12
|
+
private rpcUrl;
|
|
13
|
+
private server;
|
|
14
|
+
constructor(rpcUrl?: string);
|
|
15
|
+
/**
|
|
16
|
+
* Deploy a Soroban contract
|
|
17
|
+
*/
|
|
18
|
+
deployContract(params: ContractDeploymentParams): Promise<ContractDeploymentResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Invoke a contract method
|
|
21
|
+
*/
|
|
22
|
+
invokeContract(params: ContractInvocationParams): Promise<InvocationResult>;
|
|
23
|
+
/**
|
|
24
|
+
* Simulate contract invocation
|
|
25
|
+
*/
|
|
26
|
+
simulateInvocation(params: Omit<ContractInvocationParams, 'caller' | 'networkPassphrase'> & {
|
|
27
|
+
account?: string;
|
|
28
|
+
networkPassphrase: string;
|
|
29
|
+
}): Promise<SimulationResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Read contract state
|
|
32
|
+
*/
|
|
33
|
+
readContractState(params: ContractStateQueryParams): Promise<any>;
|
|
34
|
+
/**
|
|
35
|
+
* Query contract events
|
|
36
|
+
*/
|
|
37
|
+
queryEvents(params: ContractEventQueryParams): Promise<ContractEventDetail[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Upgrade a contract
|
|
40
|
+
*/
|
|
41
|
+
upgradeContract(params: ContractUpgradeParams): Promise<ContractUpgradeResult>;
|
|
42
|
+
/**
|
|
43
|
+
* Extract contract ID from transaction result
|
|
44
|
+
*/
|
|
45
|
+
private extractContractId;
|
|
46
|
+
/**
|
|
47
|
+
* Extract WASM hash from transaction result
|
|
48
|
+
*/
|
|
49
|
+
private extractWasmHash;
|
|
50
|
+
/**
|
|
51
|
+
* Parse events from transaction meta
|
|
52
|
+
*/
|
|
53
|
+
private parseEvents;
|
|
54
|
+
/**
|
|
55
|
+
* Parse auth from transaction result
|
|
56
|
+
*/
|
|
57
|
+
private parseAuth;
|
|
58
|
+
/**
|
|
59
|
+
* Convert simulation result to invocation result
|
|
60
|
+
*/
|
|
61
|
+
private convertSimulationToResult;
|
|
62
|
+
/**
|
|
63
|
+
* Get the RPC server instance
|
|
64
|
+
*/
|
|
65
|
+
getServer(): SorobanRpc.Server;
|
|
66
|
+
/**
|
|
67
|
+
* Get the RPC URL
|
|
68
|
+
*/
|
|
69
|
+
getRpcUrl(): string;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=soroban-contract-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"soroban-contract-manager.d.ts","sourceRoot":"","sources":["../../src/soroban/soroban-contract-manager.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,EAEL,UAAU,EAQX,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,wBAAwB,EACxB,wBAAwB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+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Soroban Contract Manager
|
|
4
|
+
* @description Main class for Soroban contract operations
|
|
5
|
+
* @author Galaxy DevKit Team
|
|
6
|
+
* @version 1.0.0
|
|
7
|
+
* @since 2024-12-01
|
|
8
|
+
* @note Type checking disabled due to Stellar SDK v14 compatibility issues
|
|
9
|
+
*/
|
|
10
|
+
import { xdr, SorobanRpc, TransactionBuilder, Contract, BASE_FEE, Address, } from '@stellar/stellar-sdk';
|
|
11
|
+
import { ScValConverter } from '../utils/scval-converter';
|
|
12
|
+
export class SorobanContractManager {
|
|
13
|
+
constructor(rpcUrl = 'https://soroban-testnet.stellar.org') {
|
|
14
|
+
this.rpcUrl = rpcUrl;
|
|
15
|
+
this.server = new SorobanRpc.Server(rpcUrl);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Deploy a Soroban contract
|
|
19
|
+
*/
|
|
20
|
+
async deployContract(params) {
|
|
21
|
+
const { wasm, deployer, networkPassphrase, salt } = params;
|
|
22
|
+
try {
|
|
23
|
+
// Get account information
|
|
24
|
+
const account = await this.server.getAccount(deployer.publicKey());
|
|
25
|
+
// Create contract deployment transaction
|
|
26
|
+
const contractArgs = salt ? [salt] : [];
|
|
27
|
+
const contract = new Contract(deployer.publicKey());
|
|
28
|
+
const operation = xdr.HostFunction.hostFunctionTypeCreateContract({
|
|
29
|
+
contractIdPreimage: xdr.ContractIdPreimage.contractIdPreimageFromAddress(new Address(deployer.publicKey()).toScAddress(), salt || xdr.ScVal.scvVoid()),
|
|
30
|
+
executable: xdr.ContractExecutable.contractExecutableWasm(wasm),
|
|
31
|
+
});
|
|
32
|
+
const tx = new TransactionBuilder(account, {
|
|
33
|
+
fee: BASE_FEE,
|
|
34
|
+
networkPassphrase,
|
|
35
|
+
})
|
|
36
|
+
.addOperation({
|
|
37
|
+
type: 'invokeHostFunction',
|
|
38
|
+
hostFunction: operation,
|
|
39
|
+
})
|
|
40
|
+
.setTimeout(30)
|
|
41
|
+
.build();
|
|
42
|
+
// Simulate transaction
|
|
43
|
+
const simulation = await this.server.simulateTransaction(tx);
|
|
44
|
+
if (!SorobanRpc.Api.isSimulationSuccess(simulation)) {
|
|
45
|
+
throw new Error(`Simulation failed: ${simulation.error}`);
|
|
46
|
+
}
|
|
47
|
+
// Prepare transaction
|
|
48
|
+
const preparedTx = SorobanRpc.Api.prepareTransaction(tx, simulation);
|
|
49
|
+
// Sign transaction
|
|
50
|
+
preparedTx.sign(deployer);
|
|
51
|
+
// Send transaction
|
|
52
|
+
const response = await this.server.sendTransaction(preparedTx);
|
|
53
|
+
if (response.status !== 'PENDING') {
|
|
54
|
+
throw new Error(`Transaction failed: ${response.status}`);
|
|
55
|
+
}
|
|
56
|
+
// Wait for transaction completion
|
|
57
|
+
const result = await this.server.getTransaction(response.hash);
|
|
58
|
+
if (!SorobanRpc.Api.isGetTransactionSuccess(result)) {
|
|
59
|
+
throw new Error(`Transaction execution failed: ${result.resultXdr}`);
|
|
60
|
+
}
|
|
61
|
+
// Extract contract ID
|
|
62
|
+
const contractId = this.extractContractId(result);
|
|
63
|
+
return {
|
|
64
|
+
contractId,
|
|
65
|
+
transactionHash: response.hash,
|
|
66
|
+
ledger: result.ledger || 0,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
throw new Error(`Contract deployment failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Invoke a contract method
|
|
75
|
+
*/
|
|
76
|
+
async invokeContract(params) {
|
|
77
|
+
const { contractId, method, args, caller, networkPassphrase, simulateOnly, } = params;
|
|
78
|
+
try {
|
|
79
|
+
// Get account information
|
|
80
|
+
const account = await this.server.getAccount(caller.publicKey());
|
|
81
|
+
// Create contract instance
|
|
82
|
+
const contract = new Contract(contractId);
|
|
83
|
+
// Encode arguments
|
|
84
|
+
const scArgs = ScValConverter.encodeArgs(args);
|
|
85
|
+
// Create operation
|
|
86
|
+
const tx = new TransactionBuilder(account, {
|
|
87
|
+
fee: BASE_FEE,
|
|
88
|
+
networkPassphrase,
|
|
89
|
+
})
|
|
90
|
+
.addOperation(contract.call(method, ...scArgs))
|
|
91
|
+
.setTimeout(30)
|
|
92
|
+
.build();
|
|
93
|
+
// Simulate transaction
|
|
94
|
+
const simulation = await this.server.simulateTransaction(tx);
|
|
95
|
+
if (!SorobanRpc.Api.isSimulationSuccess(simulation)) {
|
|
96
|
+
throw new Error(`Simulation failed: ${simulation.error}`);
|
|
97
|
+
}
|
|
98
|
+
if (simulateOnly) {
|
|
99
|
+
return this.convertSimulationToResult(simulation);
|
|
100
|
+
}
|
|
101
|
+
// Prepare transaction
|
|
102
|
+
const preparedTx = SorobanRpc.Api.prepareTransaction(tx, simulation);
|
|
103
|
+
// Sign transaction
|
|
104
|
+
preparedTx.sign(caller);
|
|
105
|
+
// Send transaction
|
|
106
|
+
const response = await this.server.sendTransaction(preparedTx);
|
|
107
|
+
if (response.status !== 'PENDING') {
|
|
108
|
+
throw new Error(`Transaction failed: ${response.status}`);
|
|
109
|
+
}
|
|
110
|
+
// Wait for transaction completion
|
|
111
|
+
const result = await this.server.getTransaction(response.hash);
|
|
112
|
+
if (!SorobanRpc.Api.isGetTransactionSuccess(result)) {
|
|
113
|
+
throw new Error(`Transaction execution failed: ${result.resultXdr}`);
|
|
114
|
+
}
|
|
115
|
+
// Parse results
|
|
116
|
+
const txMeta = result.resultMetaXdr;
|
|
117
|
+
const events = this.parseEvents(txMeta);
|
|
118
|
+
const auth = this.parseAuth(result.returnValue);
|
|
119
|
+
return {
|
|
120
|
+
result: result.returnValue,
|
|
121
|
+
transactionHash: response.hash,
|
|
122
|
+
ledger: result.ledger || 0,
|
|
123
|
+
events,
|
|
124
|
+
auth,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
throw new Error(`Contract invocation failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Simulate contract invocation
|
|
133
|
+
*/
|
|
134
|
+
async simulateInvocation(params) {
|
|
135
|
+
const { contractId, method, args, account, networkPassphrase } = params;
|
|
136
|
+
try {
|
|
137
|
+
// Use provided account or create a mock account
|
|
138
|
+
const sourceAccount = account
|
|
139
|
+
? await this.server.getAccount(account)
|
|
140
|
+
: new SorobanRpc.Api.Account(account ||
|
|
141
|
+
'GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF', '1');
|
|
142
|
+
// Create contract instance
|
|
143
|
+
const contract = new Contract(contractId);
|
|
144
|
+
// Encode arguments
|
|
145
|
+
const scArgs = ScValConverter.encodeArgs(args);
|
|
146
|
+
// Create transaction
|
|
147
|
+
const tx = new TransactionBuilder(sourceAccount, {
|
|
148
|
+
fee: BASE_FEE,
|
|
149
|
+
networkPassphrase,
|
|
150
|
+
})
|
|
151
|
+
.addOperation(contract.call(method, ...scArgs))
|
|
152
|
+
.setTimeout(30)
|
|
153
|
+
.build();
|
|
154
|
+
// Simulate transaction
|
|
155
|
+
const simulation = await this.server.simulateTransaction(tx);
|
|
156
|
+
if (!SorobanRpc.Api.isSimulationSuccess(simulation)) {
|
|
157
|
+
throw new Error(`Simulation failed: ${simulation.error}`);
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
result: simulation.result,
|
|
161
|
+
events: this.parseEvents(simulation.result),
|
|
162
|
+
auth: this.parseAuth(simulation.result),
|
|
163
|
+
cpuInstructions: simulation.cpuInstructions || 0,
|
|
164
|
+
memoryBytes: simulation.memoryBytes || 0,
|
|
165
|
+
transactionData: simulation.transactionData,
|
|
166
|
+
minResourceFee: simulation.minResourceFee || '0',
|
|
167
|
+
cost: simulation.cost,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
throw new Error(`Contract simulation failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Read contract state
|
|
176
|
+
*/
|
|
177
|
+
async readContractState(params) {
|
|
178
|
+
const { contractId, key, networkPassphrase } = params;
|
|
179
|
+
try {
|
|
180
|
+
const contract = new Contract(contractId);
|
|
181
|
+
// Convert key to ScVal if it's a string
|
|
182
|
+
const scKey = typeof key === 'string' ? ScValConverter.toScVal(key) : key;
|
|
183
|
+
// Get ledger key
|
|
184
|
+
const ledgerKey = contract.getFootprint().toLedgerKey(scKey);
|
|
185
|
+
// Get ledger entries
|
|
186
|
+
const response = await this.server.getLedgerEntries(ledgerKey);
|
|
187
|
+
if (!response.entries || response.entries.length === 0) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
const entry = response.entries[0];
|
|
191
|
+
if (!entry.val) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
// Convert from ScVal
|
|
195
|
+
return ScValConverter.fromScVal(entry.val);
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
throw new Error(`Contract state query failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Query contract events
|
|
203
|
+
*/
|
|
204
|
+
async queryEvents(params) {
|
|
205
|
+
const { contractId, startLedger, endLedger, eventTypes, topics, networkPassphrase, } = params;
|
|
206
|
+
try {
|
|
207
|
+
// Build event filters
|
|
208
|
+
const filters = [];
|
|
209
|
+
if (eventTypes && eventTypes.length > 0) {
|
|
210
|
+
filters.push({
|
|
211
|
+
type: 'contract',
|
|
212
|
+
contractIds: [contractId],
|
|
213
|
+
topics: eventTypes.map((type) => ({
|
|
214
|
+
type: 'string',
|
|
215
|
+
value: type,
|
|
216
|
+
})),
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
filters.push({
|
|
221
|
+
type: 'contract',
|
|
222
|
+
contractIds: [contractId],
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
// Get events
|
|
226
|
+
const events = await this.server.getEvents({
|
|
227
|
+
startLedger,
|
|
228
|
+
endLedger,
|
|
229
|
+
filters,
|
|
230
|
+
});
|
|
231
|
+
return events.events.map(event => ({
|
|
232
|
+
contractId: event.contractId?.toString() || '',
|
|
233
|
+
type: event.type.toString(),
|
|
234
|
+
topics: event.topics || [],
|
|
235
|
+
data: event.data || xdr.ScVal.scvVoid(),
|
|
236
|
+
timestamp: event.timestamp || 0,
|
|
237
|
+
ledger: event.ledger || 0,
|
|
238
|
+
txHash: event.txHash || '',
|
|
239
|
+
...event,
|
|
240
|
+
}));
|
|
241
|
+
}
|
|
242
|
+
catch (error) {
|
|
243
|
+
throw new Error(`Event query failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Upgrade a contract
|
|
248
|
+
*/
|
|
249
|
+
async upgradeContract(params) {
|
|
250
|
+
const { contractId, newWasm, admin, networkPassphrase } = params;
|
|
251
|
+
try {
|
|
252
|
+
// Get account information
|
|
253
|
+
const account = await this.server.getAccount(admin.publicKey());
|
|
254
|
+
// Create contract instance
|
|
255
|
+
const contract = new Contract(contractId);
|
|
256
|
+
// Create upload operation
|
|
257
|
+
const uploadOp = xdr.HostFunction.hostFunctionTypeUploadContractWasm(newWasm);
|
|
258
|
+
// Create upgrade operation
|
|
259
|
+
const upgradeOp = xdr.HostFunction.hostFunctionTypeCreateContract({
|
|
260
|
+
contractIdPreimage: xdr.ContractIdPreimage.contractIdPreimageFromAddress(new Address(contractId).toScAddress(), xdr.ScVal.scvVoid()),
|
|
261
|
+
executable: xdr.ContractExecutable.contractExecutableStellarAsset(),
|
|
262
|
+
});
|
|
263
|
+
// Build transaction
|
|
264
|
+
const tx = new TransactionBuilder(account, {
|
|
265
|
+
fee: BASE_FEE,
|
|
266
|
+
networkPassphrase,
|
|
267
|
+
})
|
|
268
|
+
.addOperation({ type: 'invokeHostFunction', hostFunction: uploadOp })
|
|
269
|
+
.addOperation({ type: 'invokeHostFunction', hostFunction: upgradeOp })
|
|
270
|
+
.setTimeout(30)
|
|
271
|
+
.build();
|
|
272
|
+
// Simulate transaction
|
|
273
|
+
const simulation = await this.server.simulateTransaction(tx);
|
|
274
|
+
if (!SorobanRpc.Api.isSimulationSuccess(simulation)) {
|
|
275
|
+
throw new Error(`Simulation failed: ${simulation.error}`);
|
|
276
|
+
}
|
|
277
|
+
// Prepare transaction
|
|
278
|
+
const preparedTx = SorobanRpc.Api.prepareTransaction(tx, simulation);
|
|
279
|
+
// Sign transaction
|
|
280
|
+
preparedTx.sign(admin);
|
|
281
|
+
// Send transaction
|
|
282
|
+
const response = await this.server.sendTransaction(preparedTx);
|
|
283
|
+
if (response.status !== 'PENDING') {
|
|
284
|
+
throw new Error(`Transaction failed: ${response.status}`);
|
|
285
|
+
}
|
|
286
|
+
// Wait for transaction completion
|
|
287
|
+
const result = await this.server.getTransaction(response.hash);
|
|
288
|
+
if (!SorobanRpc.Api.isGetTransactionSuccess(result)) {
|
|
289
|
+
throw new Error(`Transaction execution failed: ${result.resultXdr}`);
|
|
290
|
+
}
|
|
291
|
+
// Get new WASM hash
|
|
292
|
+
const newWasmHash = this.extractWasmHash(result);
|
|
293
|
+
return {
|
|
294
|
+
contractId,
|
|
295
|
+
transactionHash: response.hash,
|
|
296
|
+
newWasmHash,
|
|
297
|
+
ledger: result.ledger || 0,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
catch (error) {
|
|
301
|
+
throw new Error(`Contract upgrade failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Extract contract ID from transaction result
|
|
306
|
+
*/
|
|
307
|
+
extractContractId(result) {
|
|
308
|
+
// This is a simplified implementation
|
|
309
|
+
// In practice, you'd parse the transaction meta to get the contract ID
|
|
310
|
+
return result.returnValue?.toString() || '';
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Extract WASM hash from transaction result
|
|
314
|
+
*/
|
|
315
|
+
extractWasmHash(result) {
|
|
316
|
+
// This is a simplified implementation
|
|
317
|
+
// In practice, you'd parse the transaction meta to get the WASM hash
|
|
318
|
+
return result.returnValue?.toString() || '';
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Parse events from transaction meta
|
|
322
|
+
*/
|
|
323
|
+
parseEvents(meta) {
|
|
324
|
+
if (!meta)
|
|
325
|
+
return [];
|
|
326
|
+
const events = [];
|
|
327
|
+
const sorobanMeta = meta.v3()?.sorobanMeta();
|
|
328
|
+
if (sorobanMeta) {
|
|
329
|
+
for (const event of sorobanMeta.events()) {
|
|
330
|
+
events.push({
|
|
331
|
+
contractId: event.contractId?.toString() || '',
|
|
332
|
+
type: event.type.toString(),
|
|
333
|
+
topics: event.topics(),
|
|
334
|
+
data: event.data(),
|
|
335
|
+
timestamp: 0,
|
|
336
|
+
ledger: 0,
|
|
337
|
+
txHash: '',
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return events;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Parse auth from transaction result
|
|
345
|
+
*/
|
|
346
|
+
parseAuth(result) {
|
|
347
|
+
// This is a simplified implementation
|
|
348
|
+
// In practice, you'd parse the auth entries from the result
|
|
349
|
+
return [];
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Convert simulation result to invocation result
|
|
353
|
+
*/
|
|
354
|
+
convertSimulationToResult(simulation) {
|
|
355
|
+
return {
|
|
356
|
+
result: simulation.result,
|
|
357
|
+
transactionHash: '',
|
|
358
|
+
ledger: 0,
|
|
359
|
+
events: this.parseEvents(simulation.result),
|
|
360
|
+
auth: this.parseAuth(simulation.result),
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Get the RPC server instance
|
|
365
|
+
*/
|
|
366
|
+
getServer() {
|
|
367
|
+
return this.server;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Get the RPC URL
|
|
371
|
+
*/
|
|
372
|
+
getRpcUrl() {
|
|
373
|
+
return this.rpcUrl;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
//# sourceMappingURL=soroban-contract-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"soroban-contract-manager.js","sourceRoot":"","sources":["../../src/soroban/soroban-contract-manager.ts"],"names":[],"mappings":"AAAA,cAAc;AACd;;;;;;;GAOG;AAEH,OAAO,EACL,GAAG,EACH,UAAU,EACV,kBAAkB,EAElB,QAAQ,EAER,QAAQ,EAER,OAAO,GACR,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAe1D,MAAM,OAAO,sBAAsB;IAIjC,YAAY,SAAiB,qCAAqC;QAChE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc,CAClB,MAAgC;QAEhC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QAE3D,IAAI,CAAC;YACH,0BAA0B;YAC1B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;YAEnE,yCAAyC;YACzC,MAAM,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACxC,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;YAEpD,MAAM,SAAS,GAAG,GAAG,CAAC,YAA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,EAAE,CAAC;IACZ,CAAC;IAED;;OAEG;IACK,yBAAyB,CAC/B,UAAsD;QAEtD,OAAO;YACL,MAAM,EAAE,UAAU,CAAC,MAAO;YAC1B,eAAe,EAAE,EAAE;YACnB,MAAM,EAAE,CAAC;YACT,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC;YAC3C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC;SACxC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Soroban contract types and interfaces
|
|
3
|
+
* @description Type definitions for Soroban contract operations
|
|
4
|
+
* @author Galaxy DevKit Team
|
|
5
|
+
* @version 1.0.0
|
|
6
|
+
* @since 2024-12-01
|
|
7
|
+
*/
|
|
8
|
+
import { xdr } from '@stellar/stellar-sdk';
|
|
9
|
+
import { Keypair } from '@stellar/stellar-sdk';
|
|
10
|
+
export interface ContractSpec {
|
|
11
|
+
address: string;
|
|
12
|
+
wasmHash?: string;
|
|
13
|
+
functions: ContractFunction[];
|
|
14
|
+
events: ContractEvent[];
|
|
15
|
+
}
|
|
16
|
+
export interface ContractFunction {
|
|
17
|
+
name: string;
|
|
18
|
+
inputs: Array<{
|
|
19
|
+
name: string;
|
|
20
|
+
type: ScType;
|
|
21
|
+
}>;
|
|
22
|
+
outputs: ScType[];
|
|
23
|
+
}
|
|
24
|
+
export interface ContractEvent {
|
|
25
|
+
name: string;
|
|
26
|
+
topics: ScType[];
|
|
27
|
+
data: ScType[];
|
|
28
|
+
}
|
|
29
|
+
export type ScType = 'void' | 'bool' | 'u32' | 'i32' | 'u64' | 'i64' | 'u128' | 'i128' | 'u256' | 'i256' | 'f32' | 'f64' | 'bytes' | 'string' | 'symbol' | 'address' | 'option' | 'result' | 'vec' | 'map' | 'set' | 'tuple';
|
|
30
|
+
export interface ContractDeploymentParams {
|
|
31
|
+
wasm: Buffer;
|
|
32
|
+
deployer: Keypair;
|
|
33
|
+
networkPassphrase: string;
|
|
34
|
+
salt?: xdr.ScVal;
|
|
35
|
+
}
|
|
36
|
+
export interface ContractInvocationParams {
|
|
37
|
+
contractId: string;
|
|
38
|
+
method: string;
|
|
39
|
+
args: any[];
|
|
40
|
+
caller: Keypair;
|
|
41
|
+
networkPassphrase: string;
|
|
42
|
+
simulateOnly?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface ContractStateQueryParams {
|
|
45
|
+
contractId: string;
|
|
46
|
+
key: string | xdr.ScVal;
|
|
47
|
+
networkPassphrase: string;
|
|
48
|
+
}
|
|
49
|
+
export interface ContractEventQueryParams {
|
|
50
|
+
contractId: string;
|
|
51
|
+
startLedger?: number;
|
|
52
|
+
endLedger?: number;
|
|
53
|
+
eventTypes?: string[];
|
|
54
|
+
topics?: xdr.ScVal[];
|
|
55
|
+
networkPassphrase: string;
|
|
56
|
+
}
|
|
57
|
+
export interface ContractDeploymentResult {
|
|
58
|
+
contractId: string;
|
|
59
|
+
transactionHash: string;
|
|
60
|
+
ledger: number;
|
|
61
|
+
}
|
|
62
|
+
export interface InvocationResult {
|
|
63
|
+
result: xdr.ScVal;
|
|
64
|
+
transactionHash: string;
|
|
65
|
+
ledger: number;
|
|
66
|
+
events: ContractEventDetail[];
|
|
67
|
+
auth: xdr.SorobanAuthorizationEntry[];
|
|
68
|
+
}
|
|
69
|
+
export interface SimulationResult {
|
|
70
|
+
result: xdr.ScVal;
|
|
71
|
+
events: ContractEventDetail[];
|
|
72
|
+
auth: xdr.SorobanAuthorizationEntry[];
|
|
73
|
+
cpuInstructions: number;
|
|
74
|
+
memoryBytes: number;
|
|
75
|
+
transactionData: xdr.SorobanTransactionData;
|
|
76
|
+
minResourceFee: string;
|
|
77
|
+
cost: xdr.Cost;
|
|
78
|
+
}
|
|
79
|
+
export interface ContractEventDetail {
|
|
80
|
+
contractId: string;
|
|
81
|
+
type: string;
|
|
82
|
+
topics: xdr.ScVal[];
|
|
83
|
+
data: xdr.ScVal[];
|
|
84
|
+
timestamp: number;
|
|
85
|
+
ledger: number;
|
|
86
|
+
txHash: string;
|
|
87
|
+
decodedTopics?: any[];
|
|
88
|
+
decodedData?: any;
|
|
89
|
+
eventName?: string;
|
|
90
|
+
}
|
|
91
|
+
export interface EventSubscription {
|
|
92
|
+
id: string;
|
|
93
|
+
contractId: string;
|
|
94
|
+
eventTypes?: string[];
|
|
95
|
+
onEvent: (event: ContractEventDetail) => void;
|
|
96
|
+
onError?: (error: Error) => void;
|
|
97
|
+
onClose?: () => void;
|
|
98
|
+
}
|
|
99
|
+
export interface ContractAbi {
|
|
100
|
+
name: string;
|
|
101
|
+
version: string;
|
|
102
|
+
functions: AbiFunction[];
|
|
103
|
+
types: AbiType[];
|
|
104
|
+
}
|
|
105
|
+
export interface AbiFunction {
|
|
106
|
+
name: string;
|
|
107
|
+
doc?: string;
|
|
108
|
+
inputs: AbiArgument[];
|
|
109
|
+
outputs: AbiArgument[];
|
|
110
|
+
}
|
|
111
|
+
export interface AbiArgument {
|
|
112
|
+
name: string;
|
|
113
|
+
type: string;
|
|
114
|
+
doc?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface AbiType {
|
|
117
|
+
name: string;
|
|
118
|
+
kind: string;
|
|
119
|
+
fields?: AbiField[];
|
|
120
|
+
generics?: string[];
|
|
121
|
+
}
|
|
122
|
+
export interface AbiField {
|
|
123
|
+
name: string;
|
|
124
|
+
type: string;
|
|
125
|
+
doc?: string;
|
|
126
|
+
}
|
|
127
|
+
export interface TokenContractInfo {
|
|
128
|
+
name: string;
|
|
129
|
+
symbol: string;
|
|
130
|
+
decimals: number;
|
|
131
|
+
totalSupply: string;
|
|
132
|
+
admin: string;
|
|
133
|
+
}
|
|
134
|
+
export interface ContractFactoryConfig {
|
|
135
|
+
wasm: Buffer;
|
|
136
|
+
networkPassphrase: string;
|
|
137
|
+
deployer?: Keypair;
|
|
138
|
+
}
|
|
139
|
+
export interface ContractWrapperOptions {
|
|
140
|
+
contractId: string;
|
|
141
|
+
networkPassphrase: string;
|
|
142
|
+
rpcUrl: string;
|
|
143
|
+
}
|
|
144
|
+
export interface ContractUpgradeParams {
|
|
145
|
+
contractId: string;
|
|
146
|
+
newWasm: Buffer;
|
|
147
|
+
admin: Keypair;
|
|
148
|
+
networkPassphrase: string;
|
|
149
|
+
}
|
|
150
|
+
export interface ContractUpgradeResult {
|
|
151
|
+
contractId: string;
|
|
152
|
+
transactionHash: string;
|
|
153
|
+
newWasmHash: string;
|
|
154
|
+
ledger: number;
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=contract-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-types.d.ts","sourceRoot":"","sources":["../../../src/soroban/types/contract-types.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,MAAM,EAAE,aAAa,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9C,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE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B;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-types.js","sourceRoot":"","sources":["../../../src/soroban/types/contract-types.ts"],"names":[],"mappings":"AAAA,cAAc"}
|