Skip to content

Commit

Permalink
Merge pull request #26 from thekiba/feat/transaction-contract-provider
Browse files Browse the repository at this point in the history
Feat/transaction contract provider
  • Loading branch information
dvlkv authored Feb 23, 2024
2 parents a82b3cf + 5b26fd1 commit a9ee70b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ node_modules
dist
docs
coverage
.idea


# Yarn >2.0.0
.yarn/*
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
!.yarn/versions
13 changes: 5 additions & 8 deletions src/contract/ContractProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import { Maybe } from "../utils/maybe";
import { ContractState } from "./ContractState";
import { Sender } from './Sender';
import { Contract } from './Contract';
import { Address } from "../address/Address";
import { Transaction } from "../types/Transaction";
import { OpenedContract } from "./openContract";

export type ContractGetMethodResult = {
stack: TupleReader;
Expand All @@ -26,12 +29,6 @@ export interface ContractProvider {
get(name: string, args: TupleItem[]): Promise<ContractGetMethodResult>;
external(message: Cell): Promise<void>;
internal(via: Sender, args: { value: bigint | string, bounce?: Maybe<boolean>, sendMode?: SendMode, body?: Maybe<Cell | string> }): Promise<void>;
open<T extends Contract>(contract: T): OpenedContract<T>;
getTransactions(address: Address, lt: bigint, hash: Buffer, limit?: number): Promise<Transaction[]>;
}

export interface ReopenableContractProvider extends ContractProvider {
reopenFor(contract: Contract): ContractProvider;
}

export function isReopenableContractProvider(provider: ContractProvider): provider is ReopenableContractProvider {
return !!(provider as ReopenableContractProvider)['reopenFor'];
}
2 changes: 1 addition & 1 deletion src/contract/openContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ export function openContract<T extends Contract>(src: T, factory: (params: { add
return value;
}
}) as OpenedContract<T>;
}
}
7 changes: 1 addition & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@ export * from './types/_export';

// Contract
export { Contract } from './contract/Contract';
export {
ContractProvider,
ContractGetMethodResult,
ReopenableContractProvider,
isReopenableContractProvider
} from './contract/ContractProvider';
export { ContractProvider, ContractGetMethodResult } from './contract/ContractProvider';
export { ContractState } from './contract/ContractState';
export { Sender, SenderArguments } from './contract/Sender';
export { openContract, OpenedContract } from './contract/openContract';
Expand Down

0 comments on commit a9ee70b

Please sign in to comment.