@openzeppelin/relayer-sdk
Version:
OpenZeppelin Relayer SDK
140 lines (139 loc) • 2.56 kB
TypeScript
/**
* Custom type definitions for Stellar Transaction Requests.
* Out of the box generation does not produce the desired output.
* This file is a workaround to generate the desired output.
*/
export type ScVal = {
u64: string;
} | {
i64: string;
} | {
u128: {
hi: string;
lo: string;
};
} | {
i128: {
hi: string;
lo: string;
};
} | {
i256: {
hi_hi: string;
hi_lo: string;
lo_hi: string;
lo_lo: string;
};
} | {
u256: {
hi_hi: string;
hi_lo: string;
lo_hi: string;
lo_lo: string;
};
} | {
u32: number;
} | {
i32: number;
} | {
bool: boolean;
} | {
string: string;
} | {
symbol: string;
} | {
address: string;
} | {
bytes: string;
} | {
vec: ScVal[];
} | {
map: Array<{
key: ScVal;
val: ScVal;
}>;
};
export type StellarAssetSpec = {
type: 'native';
} | {
type: 'credit_alphanum4';
code: string;
issuer: string;
} | {
type: 'credit_alphanum12';
code: string;
issuer: string;
};
export type StellarAuthSpec = {
type: 'none';
} | {
type: 'source_account';
} | {
type: 'addresses';
signers: string[];
} | {
type: 'xdr';
entries: string[];
};
export type StellarMemoSpec = {
type: 'none';
} | {
type: 'text';
value: string;
} | {
type: 'id';
value: string;
} | {
type: 'hash';
value: string;
} | {
type: 'return';
value: string;
};
export type StellarContractSource = {
from: 'address';
address: string;
} | {
from: 'contract';
contract: string;
};
export type StellarWasmSource = {
type: 'hex';
hex: string;
} | {
type: 'base64';
base64: string;
};
export type StellarOperationSpec = {
type: 'payment';
destination: string;
amount: number;
asset: StellarAssetSpec;
} | {
type: 'invoke_contract';
contract_address: string;
function_name: string;
args: ScVal[];
auth?: StellarAuthSpec;
} | {
type: 'create_contract';
source: StellarContractSource;
wasm_hash: string;
salt?: string;
constructor_args?: ScVal[];
auth?: StellarAuthSpec;
} | {
type: 'upload_wasm';
wasm: StellarWasmSource;
auth?: StellarAuthSpec;
};
export interface StellarTransactionRequest {
network: string;
source_account?: string;
operations?: StellarOperationSpec[];
transaction_xdr?: string;
fee_bump?: boolean;
max_fee?: number;
memo?: StellarMemoSpec;
valid_until?: string;
}