@tezos-x/octez.js 0.9.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/README.md +154 -0
- package/dist/lib/batch/constants.js +16 -0
- package/dist/lib/batch/rpc-batch-provider.js +319 -0
- package/dist/lib/constants.js +133 -0
- package/dist/lib/context.js +182 -0
- package/dist/lib/contract/big-map.js +70 -0
- package/dist/lib/contract/compose.js +6 -0
- package/dist/lib/contract/constants.js +4 -0
- package/dist/lib/contract/contract-methods/contract-method-factory.js +18 -0
- package/dist/lib/contract/contract-methods/contract-method-interface.js +2 -0
- package/dist/lib/contract/contract-methods/contract-method-object-param.js +72 -0
- package/dist/lib/contract/contract-methods/contract-on-chain-view.js +124 -0
- package/dist/lib/contract/contract.js +169 -0
- package/dist/lib/contract/errors.js +140 -0
- package/dist/lib/contract/index.js +30 -0
- package/dist/lib/contract/interface.js +2 -0
- package/dist/lib/contract/manager-lambda.js +71 -0
- package/dist/lib/contract/prepare.js +240 -0
- package/dist/lib/contract/rpc-contract-provider.js +724 -0
- package/dist/lib/contract/sapling-state-abstraction.js +35 -0
- package/dist/lib/contract/semantic.js +40 -0
- package/dist/lib/contract/view_lambda.js +27 -0
- package/dist/lib/errors.js +42 -0
- package/dist/lib/estimate/errors.js +16 -0
- package/dist/lib/estimate/estimate-provider-interface.js +2 -0
- package/dist/lib/estimate/estimate.js +130 -0
- package/dist/lib/estimate/index.js +20 -0
- package/dist/lib/estimate/rpc-estimate-provider.js +673 -0
- package/dist/lib/extension/extension.js +2 -0
- package/dist/lib/forger/composite-forger.js +43 -0
- package/dist/lib/forger/errors.js +30 -0
- package/dist/lib/forger/octez.js-local-forger.js +34 -0
- package/dist/lib/forger/rpc-forger.js +12 -0
- package/dist/lib/global-constants/default-global-constants-provider.js +46 -0
- package/dist/lib/global-constants/errors.js +30 -0
- package/dist/lib/global-constants/interface-global-constants-provider.js +2 -0
- package/dist/lib/global-constants/noop-global-constants-provider.js +21 -0
- package/dist/lib/import-key.js +51 -0
- package/dist/lib/injector/helper.js +18 -0
- package/dist/lib/injector/interface.js +2 -0
- package/dist/lib/injector/rpc-injector.js +38 -0
- package/dist/lib/octez.js +404 -0
- package/dist/lib/operations/ballot-operation.js +33 -0
- package/dist/lib/operations/batch-operation.js +66 -0
- package/dist/lib/operations/delegate-operation.js +57 -0
- package/dist/lib/operations/drain-delegate-operation.js +31 -0
- package/dist/lib/operations/errors.js +130 -0
- package/dist/lib/operations/failing-noop-operation.js +2 -0
- package/dist/lib/operations/increase-paid-storage-operation.js +52 -0
- package/dist/lib/operations/index.js +54 -0
- package/dist/lib/operations/operations.js +123 -0
- package/dist/lib/operations/origination-operation.js +89 -0
- package/dist/lib/operations/proposals-operation.js +30 -0
- package/dist/lib/operations/register-global-constant-operation.js +55 -0
- package/dist/lib/operations/reveal-operation.js +74 -0
- package/dist/lib/operations/smart-rollup-add-messages-operation.js +47 -0
- package/dist/lib/operations/smart-rollup-execute-outbox-message-operation.js +56 -0
- package/dist/lib/operations/smart-rollup-originate-operation.js +53 -0
- package/dist/lib/operations/transaction-operation.js +70 -0
- package/dist/lib/operations/transfer-ticket-operation.js +49 -0
- package/dist/lib/operations/types.js +90 -0
- package/dist/lib/operations/update-companion-key-operation.js +58 -0
- package/dist/lib/operations/update-consensus-key-operation.js +58 -0
- package/dist/lib/packer/interface.js +2 -0
- package/dist/lib/packer/michel-codec-packer.js +22 -0
- package/dist/lib/packer/rpc-packer.js +23 -0
- package/dist/lib/parser/interface.js +2 -0
- package/dist/lib/parser/michel-codec-parser.js +135 -0
- package/dist/lib/parser/noop-parser.js +20 -0
- package/dist/lib/prepare/index.js +18 -0
- package/dist/lib/prepare/interface.js +2 -0
- package/dist/lib/prepare/prepare-provider.js +1010 -0
- package/dist/lib/provider.js +169 -0
- package/dist/lib/read-provider/interface.js +2 -0
- package/dist/lib/read-provider/rpc-read-adapter.js +228 -0
- package/dist/lib/signer/errors.js +17 -0
- package/dist/lib/signer/noop.js +40 -0
- package/dist/lib/subscribe/create-observable-from-subscription.js +20 -0
- package/dist/lib/subscribe/errors.js +30 -0
- package/dist/lib/subscribe/filters.js +96 -0
- package/dist/lib/subscribe/interface.js +2 -0
- package/dist/lib/subscribe/observable-subscription.js +79 -0
- package/dist/lib/subscribe/polling-subcribe-provider.js +118 -0
- package/dist/lib/tz/interface.js +2 -0
- package/dist/lib/tz/rpc-tz-provider.js +63 -0
- package/dist/lib/version.js +8 -0
- package/dist/lib/wallet/batch-operation.js +84 -0
- package/dist/lib/wallet/delegation-operation.js +57 -0
- package/dist/lib/wallet/errors.js +28 -0
- package/dist/lib/wallet/increase-paid-storage-operation.js +57 -0
- package/dist/lib/wallet/index.js +25 -0
- package/dist/lib/wallet/interface.js +2 -0
- package/dist/lib/wallet/legacy.js +86 -0
- package/dist/lib/wallet/operation-factory.js +117 -0
- package/dist/lib/wallet/operation.js +157 -0
- package/dist/lib/wallet/origination-operation.js +65 -0
- package/dist/lib/wallet/receipt.js +43 -0
- package/dist/lib/wallet/register-global-constant-operation.js +62 -0
- package/dist/lib/wallet/transaction-operation.js +53 -0
- package/dist/lib/wallet/transfer-ticket-operation.js +53 -0
- package/dist/lib/wallet/wallet.js +442 -0
- package/dist/octez.es6.js +7673 -0
- package/dist/octez.es6.js.map +1 -0
- package/dist/octez.umd.js +7787 -0
- package/dist/octez.umd.js.map +1 -0
- package/dist/types/batch/constants.d.ts +3 -0
- package/dist/types/batch/rpc-batch-provider.d.ts +139 -0
- package/dist/types/constants.d.ts +81 -0
- package/dist/types/context.d.ts +100 -0
- package/dist/types/contract/big-map.d.ts +35 -0
- package/dist/types/contract/compose.d.ts +5 -0
- package/dist/types/contract/constants.d.ts +1 -0
- package/dist/types/contract/contract-methods/contract-method-factory.d.ts +14 -0
- package/dist/types/contract/contract-methods/contract-method-interface.d.ts +28 -0
- package/dist/types/contract/contract-methods/contract-method-object-param.d.ts +39 -0
- package/dist/types/contract/contract-methods/contract-on-chain-view.d.ts +43 -0
- package/dist/types/contract/contract.d.ts +75 -0
- package/dist/types/contract/errors.d.ts +83 -0
- package/dist/types/contract/index.d.ts +11 -0
- package/dist/types/contract/interface.d.ts +254 -0
- package/dist/types/contract/manager-lambda.d.ts +73 -0
- package/dist/types/contract/prepare.d.ts +18 -0
- package/dist/types/contract/rpc-contract-provider.d.ts +269 -0
- package/dist/types/contract/sapling-state-abstraction.d.ts +17 -0
- package/dist/types/contract/semantic.d.ts +7 -0
- package/dist/types/contract/view_lambda.d.ts +34 -0
- package/dist/types/errors.d.ts +26 -0
- package/dist/types/estimate/errors.d.ts +8 -0
- package/dist/types/estimate/estimate-provider-interface.d.ts +156 -0
- package/dist/types/estimate/estimate.d.ts +94 -0
- package/dist/types/estimate/index.d.ts +4 -0
- package/dist/types/estimate/rpc-estimate-provider.d.ts +170 -0
- package/dist/types/extension/extension.d.ts +4 -0
- package/dist/types/forger/composite-forger.d.ts +6 -0
- package/dist/types/forger/errors.d.ts +16 -0
- package/dist/types/forger/octez.js-local-forger.d.ts +8 -0
- package/dist/types/forger/rpc-forger.d.ts +7 -0
- package/dist/types/global-constants/default-global-constants-provider.d.ts +18 -0
- package/dist/types/global-constants/errors.d.ts +16 -0
- package/dist/types/global-constants/interface-global-constants-provider.d.ts +11 -0
- package/dist/types/global-constants/noop-global-constants-provider.d.ts +5 -0
- package/dist/types/import-key.d.ts +13 -0
- package/dist/types/injector/helper.d.ts +2 -0
- package/dist/types/injector/interface.d.ts +5 -0
- package/dist/types/injector/rpc-injector.d.ts +7 -0
- package/dist/types/octez.d.ts +248 -0
- package/dist/types/operations/ballot-operation.d.ts +18 -0
- package/dist/types/operations/batch-operation.d.ts +19 -0
- package/dist/types/operations/delegate-operation.d.ts +24 -0
- package/dist/types/operations/drain-delegate-operation.d.ts +17 -0
- package/dist/types/operations/errors.d.ts +50 -0
- package/dist/types/operations/failing-noop-operation.d.ts +17 -0
- package/dist/types/operations/increase-paid-storage-operation.d.ts +23 -0
- package/dist/types/operations/index.d.ts +18 -0
- package/dist/types/operations/operations.d.ts +35 -0
- package/dist/types/operations/origination-operation.d.ts +35 -0
- package/dist/types/operations/proposals-operation.d.ts +17 -0
- package/dist/types/operations/register-global-constant-operation.d.ts +25 -0
- package/dist/types/operations/reveal-operation.d.ts +25 -0
- package/dist/types/operations/smart-rollup-add-messages-operation.d.ts +20 -0
- package/dist/types/operations/smart-rollup-execute-outbox-message-operation.d.ts +24 -0
- package/dist/types/operations/smart-rollup-originate-operation.d.ts +23 -0
- package/dist/types/operations/transaction-operation.d.ts +28 -0
- package/dist/types/operations/transfer-ticket-operation.d.ts +22 -0
- package/dist/types/operations/types.d.ts +461 -0
- package/dist/types/operations/update-companion-key-operation.d.ts +23 -0
- package/dist/types/operations/update-consensus-key-operation.d.ts +23 -0
- package/dist/types/packer/interface.d.ts +4 -0
- package/dist/types/packer/michel-codec-packer.d.ts +5 -0
- package/dist/types/packer/rpc-packer.d.ts +8 -0
- package/dist/types/parser/interface.d.ts +4 -0
- package/dist/types/parser/michel-codec-parser.d.ts +16 -0
- package/dist/types/parser/noop-parser.d.ts +5 -0
- package/dist/types/prepare/index.d.ts +2 -0
- package/dist/types/prepare/interface.d.ts +153 -0
- package/dist/types/prepare/prepare-provider.d.ts +213 -0
- package/dist/types/provider.d.ts +44 -0
- package/dist/types/read-provider/interface.d.ts +132 -0
- package/dist/types/read-provider/rpc-read-adapter.d.ts +130 -0
- package/dist/types/signer/errors.d.ts +8 -0
- package/dist/types/signer/noop.d.ts +11 -0
- package/dist/types/subscribe/create-observable-from-subscription.d.ts +4 -0
- package/dist/types/subscribe/errors.d.ts +18 -0
- package/dist/types/subscribe/filters.d.ts +6 -0
- package/dist/types/subscribe/interface.d.ts +48 -0
- package/dist/types/subscribe/observable-subscription.d.ts +21 -0
- package/dist/types/subscribe/polling-subcribe-provider.d.ts +23 -0
- package/dist/types/tz/interface.d.ts +20 -0
- package/dist/types/tz/rpc-tz-provider.d.ts +13 -0
- package/dist/types/version.d.ts +4 -0
- package/dist/types/wallet/batch-operation.d.ts +13 -0
- package/dist/types/wallet/delegation-operation.d.ts +12 -0
- package/dist/types/wallet/errors.d.ts +16 -0
- package/dist/types/wallet/increase-paid-storage-operation.d.ts +12 -0
- package/dist/types/wallet/index.d.ts +9 -0
- package/dist/types/wallet/interface.d.ts +66 -0
- package/dist/types/wallet/legacy.d.ts +21 -0
- package/dist/types/wallet/operation-factory.d.ts +32 -0
- package/dist/types/wallet/operation.d.ts +54 -0
- package/dist/types/wallet/origination-operation.d.ts +14 -0
- package/dist/types/wallet/receipt.d.ts +16 -0
- package/dist/types/wallet/register-global-constant-operation.d.ts +13 -0
- package/dist/types/wallet/transaction-operation.d.ts +12 -0
- package/dist/types/wallet/transfer-ticket-operation.d.ts +12 -0
- package/dist/types/wallet/wallet.d.ts +195 -0
- package/package.json +131 -0
- package/patch.js +20 -0
- package/signature.json +866 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TezosToolkitConfigError } from '@tezos-x/octez.js-core';
|
|
2
|
+
/**
|
|
3
|
+
* @category Error
|
|
4
|
+
* @description Error that indicates no signer has been configured in the TezosToolkit instance
|
|
5
|
+
*/
|
|
6
|
+
export declare class UnconfiguredSignerError extends TezosToolkitConfigError {
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Signer } from '@tezos-x/octez.js-core';
|
|
2
|
+
/**
|
|
3
|
+
* @description Default signer implementation which does nothing and produce invalid signature
|
|
4
|
+
* @throw {@link UnconfiguredSignerError}
|
|
5
|
+
*/
|
|
6
|
+
export declare class NoopSigner implements Signer {
|
|
7
|
+
publicKey(): Promise<string>;
|
|
8
|
+
publicKeyHash(): Promise<string>;
|
|
9
|
+
secretKey(): Promise<string>;
|
|
10
|
+
sign(_bytes: string, _watermark?: Uint8Array): Promise<any>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BlockResponse } from '@tezos-x/octez.js-rpc';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { OperationContent, Subscription } from './interface';
|
|
4
|
+
export declare function createObservableFromSubscription<T extends BlockResponse | string | OperationContent>(sub: Subscription<T>): Observable<T>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ParameterValidationError } from '@tezos-x/octez.js-core';
|
|
2
|
+
import { FilterExpression } from '../octez';
|
|
3
|
+
/**
|
|
4
|
+
* @category Error
|
|
5
|
+
* @description Error that indicates an unsupported event being passed or used
|
|
6
|
+
*/
|
|
7
|
+
export declare class UnsupportedEventError extends ParameterValidationError {
|
|
8
|
+
readonly type: string;
|
|
9
|
+
constructor(type: string);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @category Error
|
|
13
|
+
* @description Error that indicates an invalid filter expression being passed or used
|
|
14
|
+
*/
|
|
15
|
+
export declare class InvalidFilterExpressionError extends ParameterValidationError {
|
|
16
|
+
readonly invalidExpression: FilterExpression;
|
|
17
|
+
constructor(invalidExpression: FilterExpression);
|
|
18
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OpFilter, FilterExpression, Filter, OperationContent } from './interface';
|
|
2
|
+
import { InternalOperationResult } from '@tezos-x/octez.js-rpc';
|
|
3
|
+
export declare const eventFilter: (result: InternalOperationResult, address?: string, tag?: string, excludeFailedOperations?: boolean) => boolean;
|
|
4
|
+
export declare const evaluateOpFilter: (op: OperationContent, filter: OpFilter) => boolean | undefined;
|
|
5
|
+
export declare const evaluateExpression: (op: OperationContent, exp: FilterExpression) => boolean;
|
|
6
|
+
export declare const evaluateFilter: (op: OperationContent, filter: Filter) => boolean;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { BlockResponse, InternalOperationResult, OperationEntry } from '@tezos-x/octez.js-rpc';
|
|
2
|
+
export type FilterExpression = {
|
|
3
|
+
or?: ExpressionOrOpFilter[];
|
|
4
|
+
and?: ExpressionOrOpFilter[];
|
|
5
|
+
};
|
|
6
|
+
export interface OpHashFilter {
|
|
7
|
+
opHash: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SourceFilter {
|
|
10
|
+
source: string;
|
|
11
|
+
}
|
|
12
|
+
export interface KindFilter {
|
|
13
|
+
kind: string;
|
|
14
|
+
}
|
|
15
|
+
export interface DestinationFilter {
|
|
16
|
+
destination: string;
|
|
17
|
+
}
|
|
18
|
+
export interface EventFilter {
|
|
19
|
+
address?: string;
|
|
20
|
+
tag?: string;
|
|
21
|
+
excludeFailedOperations?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface EventSubscription extends InternalOperationResult {
|
|
24
|
+
opHash: string;
|
|
25
|
+
blockHash: string;
|
|
26
|
+
level: number;
|
|
27
|
+
}
|
|
28
|
+
export type OpFilter = OpHashFilter | SourceFilter | KindFilter | DestinationFilter | EventFilter;
|
|
29
|
+
export type ExpressionOrOpFilter = OpFilter | FilterExpression;
|
|
30
|
+
export type Filter = ExpressionOrOpFilter | ExpressionOrOpFilter[];
|
|
31
|
+
export type OperationContent = OperationEntry['contents'][0] & {
|
|
32
|
+
hash: string;
|
|
33
|
+
};
|
|
34
|
+
export interface SubscribeProvider {
|
|
35
|
+
subscribe(filter: 'head'): Subscription<string>;
|
|
36
|
+
subscribeBlock(filter: 'head'): Subscription<BlockResponse>;
|
|
37
|
+
subscribeOperation(filter: Filter): Subscription<OperationContent>;
|
|
38
|
+
subscribeEvent(filter?: EventFilter): Subscription<InternalOperationResult>;
|
|
39
|
+
}
|
|
40
|
+
export interface Subscription<T> {
|
|
41
|
+
on(type: 'error', cb: (error: Error) => void): void;
|
|
42
|
+
on(type: 'data', cb: (data: T) => void): void;
|
|
43
|
+
on(type: 'close', cb: () => void): void;
|
|
44
|
+
off(type: 'error', cb: (error: Error) => void): void;
|
|
45
|
+
off(type: 'data', cb: (data: T) => void): void;
|
|
46
|
+
off(type: 'close', cb: () => void): void;
|
|
47
|
+
close(): void;
|
|
48
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Observable, OperatorFunction } from 'rxjs';
|
|
2
|
+
import { Subscription } from './interface';
|
|
3
|
+
export { UnsupportedEventError } from './errors';
|
|
4
|
+
export declare class ObservableSubscription<T> implements Subscription<T> {
|
|
5
|
+
private shouldRetry;
|
|
6
|
+
private operatorFunction;
|
|
7
|
+
private errorListeners;
|
|
8
|
+
private messageListeners;
|
|
9
|
+
private closeListeners;
|
|
10
|
+
private completed$;
|
|
11
|
+
constructor(obs: Observable<T>, shouldRetry?: boolean, operatorFunction?: OperatorFunction<T, T>);
|
|
12
|
+
private call;
|
|
13
|
+
private remove;
|
|
14
|
+
on(type: 'error', cb: (error: Error) => void): void;
|
|
15
|
+
on(type: 'data', cb: (data: T) => void): void;
|
|
16
|
+
on(type: 'close', cb: () => void): void;
|
|
17
|
+
off(type: 'error', cb: (error: Error) => void): void;
|
|
18
|
+
off(type: 'data', cb: (data: T) => void): void;
|
|
19
|
+
off(type: 'close', cb: () => void): void;
|
|
20
|
+
close(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BlockResponse, InternalOperationResult } from '@tezos-x/octez.js-rpc';
|
|
2
|
+
import { OperatorFunction } from 'rxjs';
|
|
3
|
+
import { Context } from '../context';
|
|
4
|
+
import { Filter, EventFilter, SubscribeProvider, Subscription, OperationContent } from './interface';
|
|
5
|
+
export interface PollingSubscribeProviderConfig {
|
|
6
|
+
pollingIntervalMilliseconds?: number;
|
|
7
|
+
shouldObservableSubscriptionRetry: boolean;
|
|
8
|
+
observableSubscriptionRetryFunction: OperatorFunction<any, any>;
|
|
9
|
+
}
|
|
10
|
+
export declare const defaultConfigStreamer: PollingSubscribeProviderConfig;
|
|
11
|
+
export declare class PollingSubscribeProvider implements SubscribeProvider {
|
|
12
|
+
private context;
|
|
13
|
+
private _config$;
|
|
14
|
+
private timer$;
|
|
15
|
+
private newBlock$;
|
|
16
|
+
constructor(context: Context, config?: Partial<PollingSubscribeProviderConfig>);
|
|
17
|
+
get config(): PollingSubscribeProviderConfig;
|
|
18
|
+
private getConfirmationPollingInterval;
|
|
19
|
+
subscribeBlock(_filter: 'head'): Subscription<BlockResponse>;
|
|
20
|
+
subscribe(_filter: 'head'): Subscription<string>;
|
|
21
|
+
subscribeOperation(filter: Filter): Subscription<OperationContent>;
|
|
22
|
+
subscribeEvent(eventFilter?: EventFilter): Subscription<InternalOperationResult>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
|
+
import { Operation } from '../operations/operations';
|
|
3
|
+
export interface TzProvider {
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param address Tezos address you want to get the spendable balance for (eg tz1...)
|
|
7
|
+
*/
|
|
8
|
+
getBalance(address: string): Promise<BigNumber>;
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param address Tezos address you want to get the spendable balance for (eg tz1...)
|
|
12
|
+
*/
|
|
13
|
+
getSpendable(address: string): Promise<BigNumber>;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param address Tezos address you want to get the delegate for (eg tz1...)
|
|
17
|
+
*/
|
|
18
|
+
getDelegate(address: string): Promise<string | null>;
|
|
19
|
+
activate(pkh: string, secret: string): Promise<Operation>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
|
+
import { Context } from '../context';
|
|
3
|
+
import { Operation } from '../operations/operations';
|
|
4
|
+
import { TzProvider } from './interface';
|
|
5
|
+
import { Provider } from '../provider';
|
|
6
|
+
export declare class RpcTzProvider extends Provider implements TzProvider {
|
|
7
|
+
constructor(context: Context);
|
|
8
|
+
private prepare;
|
|
9
|
+
getBalance(address: string): Promise<BigNumber>;
|
|
10
|
+
getSpendable(address: string): Promise<BigNumber>;
|
|
11
|
+
getDelegate(address: string): Promise<string | null>;
|
|
12
|
+
activate(pkh: string, secret: string): Promise<Operation>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BlockResponse, OperationContentsAndResultReveal, OpKind } from '@tezos-x/octez.js-rpc';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { Context } from '../context';
|
|
4
|
+
import { WalletOperation, OperationStatus } from './operation';
|
|
5
|
+
export declare const WALLET_BATCH_KINDS: OpKind[];
|
|
6
|
+
export declare class BatchWalletOperation extends WalletOperation {
|
|
7
|
+
readonly opHash: string;
|
|
8
|
+
protected readonly context: Context;
|
|
9
|
+
constructor(opHash: string, context: Context, newHead$: Observable<BlockResponse>);
|
|
10
|
+
revealOperation(): Promise<OperationContentsAndResultReveal | undefined>;
|
|
11
|
+
getOriginatedContractAddresses: () => Promise<string[]>;
|
|
12
|
+
status(): Promise<OperationStatus>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BlockResponse, OperationContentsAndResultDelegation, OperationContentsAndResultReveal } from '@tezos-x/octez.js-rpc';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { Context } from '../context';
|
|
4
|
+
import { WalletOperation, OperationStatus } from './operation';
|
|
5
|
+
export declare class DelegationWalletOperation extends WalletOperation {
|
|
6
|
+
readonly opHash: string;
|
|
7
|
+
protected readonly context: Context;
|
|
8
|
+
constructor(opHash: string, context: Context, newHead$: Observable<BlockResponse>);
|
|
9
|
+
revealOperation(): Promise<OperationContentsAndResultReveal | undefined>;
|
|
10
|
+
delegationOperation(): Promise<OperationContentsAndResultDelegation | undefined>;
|
|
11
|
+
status(): Promise<OperationStatus>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TezosToolkitConfigError, NetworkError } from '@tezos-x/octez.js-core';
|
|
2
|
+
/**
|
|
3
|
+
* @category Error
|
|
4
|
+
* @description Error that indicates undefined confirmation has not been specified or configured
|
|
5
|
+
*/
|
|
6
|
+
export declare class ConfirmationUndefinedError extends TezosToolkitConfigError {
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @category Error
|
|
11
|
+
* @description Error that indicates a generic failure when trying to fetch an observable
|
|
12
|
+
*/
|
|
13
|
+
export declare class ObservableError extends NetworkError {
|
|
14
|
+
readonly message: string;
|
|
15
|
+
constructor(message: string);
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WalletOperation, OperationStatus } from './operation';
|
|
2
|
+
import { Context } from '../context';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { BlockResponse, OperationContentsAndResultReveal, OperationContentsAndResultIncreasePaidStorage } from '@tezos-x/octez.js-rpc';
|
|
5
|
+
export declare class IncreasePaidStorageWalletOperation extends WalletOperation {
|
|
6
|
+
readonly opHash: string;
|
|
7
|
+
protected readonly context: Context;
|
|
8
|
+
constructor(opHash: string, context: Context, newHead$: Observable<BlockResponse>);
|
|
9
|
+
revealOperation(): Promise<OperationContentsAndResultReveal | undefined>;
|
|
10
|
+
increasePaidStorageOperation(): Promise<OperationContentsAndResultIncreasePaidStorage | undefined>;
|
|
11
|
+
status(): Promise<OperationStatus>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './wallet';
|
|
2
|
+
export * from './operation';
|
|
3
|
+
export * from './transaction-operation';
|
|
4
|
+
export * from './origination-operation';
|
|
5
|
+
export * from './delegation-operation';
|
|
6
|
+
export * from './transfer-ticket-operation';
|
|
7
|
+
export * from './register-global-constant-operation';
|
|
8
|
+
export * from './interface';
|
|
9
|
+
export * from './legacy';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DelegateParams, FailingNoopParams, IncreasePaidStorageParams, OriginateParams, TransferParams, StakeParams, UnstakeParams, FinalizeUnstakeParams, TransferTicketParams, RegisterGlobalConstantParams } from '../operations/types';
|
|
2
|
+
export type WalletDefinedFields = 'source';
|
|
3
|
+
export type WalletTransferParams = Omit<TransferParams, WalletDefinedFields>;
|
|
4
|
+
export type WalletStakeParams = Omit<StakeParams, WalletDefinedFields>;
|
|
5
|
+
export type WalletUnstakeParams = Omit<UnstakeParams, WalletDefinedFields>;
|
|
6
|
+
export type WalletFinalizeUnstakeParams = Omit<FinalizeUnstakeParams, WalletDefinedFields>;
|
|
7
|
+
export type WalletOriginateParams<TStorage = any> = Omit<OriginateParams<TStorage>, WalletDefinedFields>;
|
|
8
|
+
export type WalletDelegateParams = Omit<DelegateParams, WalletDefinedFields>;
|
|
9
|
+
export type WalletFailingNoopParams = Omit<FailingNoopParams, WalletDefinedFields>;
|
|
10
|
+
export type WalletIncreasePaidStorageParams = Omit<IncreasePaidStorageParams, WalletDefinedFields>;
|
|
11
|
+
export type WalletTransferTicketParams = Omit<TransferTicketParams, WalletDefinedFields>;
|
|
12
|
+
export type WalletRegisterGlobalConstantParams = Omit<RegisterGlobalConstantParams, WalletDefinedFields>;
|
|
13
|
+
export interface WalletProvider {
|
|
14
|
+
/**
|
|
15
|
+
* @description Request the public key hash from the wallet
|
|
16
|
+
*/
|
|
17
|
+
getPKH: () => Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* @description Request the public key from the wallet
|
|
20
|
+
*/
|
|
21
|
+
getPK: () => Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* @description Transform WalletTransferParams into a format compliant with the underlying wallet
|
|
24
|
+
*/
|
|
25
|
+
mapTransferParamsToWalletParams: (params: () => Promise<WalletTransferParams>) => Promise<any>;
|
|
26
|
+
/**
|
|
27
|
+
* @description Transform WalletTransferTicketParams into a format compliant with the underlying wallet
|
|
28
|
+
*/
|
|
29
|
+
mapTransferTicketParamsToWalletParams: (params: () => Promise<WalletTransferTicketParams>) => Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* @description Transform WalletRegisterGlobalConstantParams into a format compliant with the underlying wallet
|
|
32
|
+
*/
|
|
33
|
+
mapRegisterGlobalConstantParamsToWalletParams: (params: () => Promise<WalletRegisterGlobalConstantParams>) => Promise<any>;
|
|
34
|
+
/**
|
|
35
|
+
* @description Transform WalletStakeParams into a format compliant with the underlying wallet
|
|
36
|
+
*/
|
|
37
|
+
mapStakeParamsToWalletParams: (params: () => Promise<WalletStakeParams>) => Promise<any>;
|
|
38
|
+
/**
|
|
39
|
+
* @description Transform WalletUnstakeParams into a format compliant with the underlying wallet
|
|
40
|
+
*/
|
|
41
|
+
mapUnstakeParamsToWalletParams: (params: () => Promise<WalletUnstakeParams>) => Promise<any>;
|
|
42
|
+
/**
|
|
43
|
+
* @description Transform WalletFinalizeUnstakeParams into a format compliant with the underlying wallet
|
|
44
|
+
*/
|
|
45
|
+
mapFinalizeUnstakeParamsToWalletParams: (params: () => Promise<WalletFinalizeUnstakeParams>) => Promise<any>;
|
|
46
|
+
/**
|
|
47
|
+
* @description Transform WalletOriginateParams into a format compliant with the underlying wallet
|
|
48
|
+
*/
|
|
49
|
+
mapOriginateParamsToWalletParams: (params: () => Promise<WalletOriginateParams>) => Promise<any>;
|
|
50
|
+
/**
|
|
51
|
+
* @description Transform WalletDelegateParams into a format compliant with the underlying wallet
|
|
52
|
+
*/
|
|
53
|
+
mapDelegateParamsToWalletParams: (params: () => Promise<WalletDelegateParams>) => Promise<any>;
|
|
54
|
+
/**
|
|
55
|
+
* @description Transform WalletIncreasePaidStorageParams into a format compliant with the underlying wallet
|
|
56
|
+
*/
|
|
57
|
+
mapIncreasePaidStorageWalletParams: (params: () => Promise<WalletIncreasePaidStorageParams>) => Promise<any>;
|
|
58
|
+
/**
|
|
59
|
+
* @description Request the wallet to send an operation batch
|
|
60
|
+
*/
|
|
61
|
+
sendOperations: (params: any[]) => Promise<string>;
|
|
62
|
+
/**
|
|
63
|
+
* @description Request the wallet to sign a payload
|
|
64
|
+
*/
|
|
65
|
+
sign(bytes: string, watermark?: Uint8Array): Promise<string>;
|
|
66
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Context } from '../context';
|
|
2
|
+
import { OpKind } from '../operations/types';
|
|
3
|
+
import { WalletDelegateParams, WalletIncreasePaidStorageParams, WalletOriginateParams, WalletProvider, WalletTransferParams, WalletStakeParams, WalletUnstakeParams, WalletFinalizeUnstakeParams, WalletTransferTicketParams, WalletRegisterGlobalConstantParams } from './interface';
|
|
4
|
+
import { WalletParamsWithKind } from './wallet';
|
|
5
|
+
export declare class LegacyWalletProvider implements WalletProvider {
|
|
6
|
+
private context;
|
|
7
|
+
constructor(context: Context);
|
|
8
|
+
getPKH(): Promise<string>;
|
|
9
|
+
getPK(): Promise<string>;
|
|
10
|
+
mapTransferParamsToWalletParams(params: () => Promise<WalletTransferParams>): Promise<import("../operations/types").withKind<WalletTransferParams, OpKind.TRANSACTION>>;
|
|
11
|
+
mapStakeParamsToWalletParams(params: () => Promise<WalletStakeParams>): Promise<import("../operations/types").withKind<WalletStakeParams, OpKind.TRANSACTION>>;
|
|
12
|
+
mapUnstakeParamsToWalletParams(params: () => Promise<WalletUnstakeParams>): Promise<import("../operations/types").withKind<WalletUnstakeParams, OpKind.TRANSACTION>>;
|
|
13
|
+
mapFinalizeUnstakeParamsToWalletParams(params: () => Promise<WalletFinalizeUnstakeParams>): Promise<import("../operations/types").withKind<WalletFinalizeUnstakeParams, OpKind.TRANSACTION>>;
|
|
14
|
+
mapOriginateParamsToWalletParams(params: () => Promise<WalletOriginateParams>): Promise<import("../operations/types").withKind<WalletOriginateParams, OpKind.ORIGINATION>>;
|
|
15
|
+
mapDelegateParamsToWalletParams(params: () => Promise<WalletDelegateParams>): Promise<import("../operations/types").withKind<WalletDelegateParams, OpKind.DELEGATION>>;
|
|
16
|
+
mapIncreasePaidStorageWalletParams(params: () => Promise<WalletIncreasePaidStorageParams>): Promise<import("../operations/types").withKind<WalletIncreasePaidStorageParams, OpKind.INCREASE_PAID_STORAGE>>;
|
|
17
|
+
mapTransferTicketParamsToWalletParams(params: () => Promise<WalletTransferTicketParams>): Promise<import("../operations/types").withKind<WalletTransferTicketParams, OpKind.TRANSFER_TICKET>>;
|
|
18
|
+
mapRegisterGlobalConstantParamsToWalletParams(params: () => Promise<WalletRegisterGlobalConstantParams>): Promise<import("../operations/types").withKind<WalletRegisterGlobalConstantParams, OpKind.REGISTER_GLOBAL_CONSTANT>>;
|
|
19
|
+
sendOperations(params: WalletParamsWithKind[]): Promise<string>;
|
|
20
|
+
sign(bytes: string, watermark?: Uint8Array): Promise<string>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BlockResponse } from '@tezos-x/octez.js-rpc';
|
|
2
|
+
import { Observable, SchedulerLike } from 'rxjs';
|
|
3
|
+
import { Context } from '../context';
|
|
4
|
+
import { BatchWalletOperation } from './batch-operation';
|
|
5
|
+
import { DelegationWalletOperation } from './delegation-operation';
|
|
6
|
+
import { IncreasePaidStorageWalletOperation } from './increase-paid-storage-operation';
|
|
7
|
+
import { WalletOperation } from './operation';
|
|
8
|
+
import { OriginationWalletOperation } from './origination-operation';
|
|
9
|
+
import { TransactionWalletOperation } from './transaction-operation';
|
|
10
|
+
import { TransferTicketWalletOperation } from './transfer-ticket-operation';
|
|
11
|
+
import { RegisterGlobalConstantWalletOperation } from './register-global-constant-operation';
|
|
12
|
+
export declare function timeoutAfter<T>(timeoutMillisec: number): (source: Observable<T>) => Observable<T>;
|
|
13
|
+
export declare const createNewPollingBasedHeadObservable: (sharedHeadOb: Observable<BlockResponse>, context: Context, _scheduler?: SchedulerLike) => Observable<BlockResponse>;
|
|
14
|
+
export interface OperationFactoryConfig {
|
|
15
|
+
blockIdentifier?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class OperationFactory {
|
|
18
|
+
private context;
|
|
19
|
+
constructor(context: Context);
|
|
20
|
+
private sharedHeadObs;
|
|
21
|
+
private createNewHeadObservable;
|
|
22
|
+
private createPastBlockWalker;
|
|
23
|
+
private createHeadObservableFromConfig;
|
|
24
|
+
createOperation(hash: string, config?: OperationFactoryConfig): Promise<WalletOperation>;
|
|
25
|
+
createBatchOperation(hash: string, config?: OperationFactoryConfig): Promise<BatchWalletOperation>;
|
|
26
|
+
createTransactionOperation(hash: string, config?: OperationFactoryConfig): Promise<TransactionWalletOperation>;
|
|
27
|
+
createTransferTicketOperation(hash: string, config?: OperationFactoryConfig): Promise<TransferTicketWalletOperation>;
|
|
28
|
+
createDelegationOperation(hash: string, config?: OperationFactoryConfig): Promise<DelegationWalletOperation>;
|
|
29
|
+
createOriginationOperation(hash: string, config?: OperationFactoryConfig): Promise<OriginationWalletOperation>;
|
|
30
|
+
createIncreasePaidStorageOperation(hash: string, config?: OperationFactoryConfig): Promise<IncreasePaidStorageWalletOperation>;
|
|
31
|
+
createRegisterGlobalConstantOperation(hash: string, config?: OperationFactoryConfig): Promise<RegisterGlobalConstantWalletOperation>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { BlockResponse, OperationContentsAndResult, OperationResultStatusEnum } from '@tezos-x/octez.js-rpc';
|
|
2
|
+
import { Observable, ReplaySubject } from 'rxjs';
|
|
3
|
+
import { Context } from '../context';
|
|
4
|
+
import { Receipt } from './receipt';
|
|
5
|
+
import { BlockIdentifier } from '../read-provider/interface';
|
|
6
|
+
export type OperationStatus = 'pending' | 'unknown' | OperationResultStatusEnum;
|
|
7
|
+
/**
|
|
8
|
+
* @description WalletOperation allows to monitor operation inclusion on chains and surface information related to the operation
|
|
9
|
+
*/
|
|
10
|
+
export declare class WalletOperation {
|
|
11
|
+
readonly opHash: string;
|
|
12
|
+
protected readonly context: Context;
|
|
13
|
+
private _newHead$;
|
|
14
|
+
protected _operationResult: ReplaySubject<OperationContentsAndResult[]>;
|
|
15
|
+
protected _includedInBlock: ReplaySubject<BlockResponse>;
|
|
16
|
+
protected _included: boolean;
|
|
17
|
+
private lastHead;
|
|
18
|
+
protected newHead$: Observable<BlockResponse>;
|
|
19
|
+
private confirmed$;
|
|
20
|
+
operationResults(): Promise<OperationContentsAndResult[] | undefined>;
|
|
21
|
+
/**
|
|
22
|
+
* @description Receipt expose the total amount of tezos token burn and spent on fees
|
|
23
|
+
* The promise returned by receipt will resolve only once the transaction is included
|
|
24
|
+
*/
|
|
25
|
+
receipt(): Promise<Receipt>;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param opHash Operation hash
|
|
29
|
+
* @param raw Raw operation that was injected
|
|
30
|
+
* @param context Taquito context allowing access to rpc and signer
|
|
31
|
+
* @throws {InvalidOperationHashError}
|
|
32
|
+
*/
|
|
33
|
+
constructor(opHash: string, context: Context, _newHead$: Observable<BlockResponse>);
|
|
34
|
+
getCurrentConfirmation(): Promise<number | undefined>;
|
|
35
|
+
isInCurrentBranch(tipBlockIdentifier?: BlockIdentifier): Promise<boolean>;
|
|
36
|
+
confirmationObservable(confirmations?: number): Observable<{
|
|
37
|
+
block: BlockResponse;
|
|
38
|
+
expectedConfirmation: number;
|
|
39
|
+
currentConfirmation: number;
|
|
40
|
+
completed: boolean;
|
|
41
|
+
isInCurrentBranch: () => Promise<boolean>;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param confirmations [0] Number of confirmation to wait for
|
|
46
|
+
*/
|
|
47
|
+
confirmation(confirmations?: number): Promise<{
|
|
48
|
+
block: BlockResponse;
|
|
49
|
+
expectedConfirmation: number;
|
|
50
|
+
currentConfirmation: number;
|
|
51
|
+
completed: boolean;
|
|
52
|
+
isInCurrentBranch: () => Promise<boolean>;
|
|
53
|
+
} | undefined>;
|
|
54
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BlockResponse, OperationContentsAndResultOrigination, OperationContentsAndResultReveal } from '@tezos-x/octez.js-rpc';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { Context } from '../context';
|
|
4
|
+
import { DefaultWalletType } from '../contract/contract';
|
|
5
|
+
import { WalletOperation, OperationStatus } from './operation';
|
|
6
|
+
export declare class OriginationWalletOperation<TWallet extends DefaultWalletType = DefaultWalletType> extends WalletOperation {
|
|
7
|
+
readonly opHash: string;
|
|
8
|
+
protected readonly context: Context;
|
|
9
|
+
constructor(opHash: string, context: Context, newHead$: Observable<BlockResponse>);
|
|
10
|
+
originationOperation(): Promise<OperationContentsAndResultOrigination | undefined>;
|
|
11
|
+
revealOperation(): Promise<OperationContentsAndResultReveal | undefined>;
|
|
12
|
+
status(): Promise<OperationStatus>;
|
|
13
|
+
contract(): Promise<TWallet>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OperationContentsAndResult } from '@tezos-x/octez.js-rpc';
|
|
2
|
+
import BigNumber from 'bignumber.js';
|
|
3
|
+
export interface Receipt {
|
|
4
|
+
totalFee: BigNumber;
|
|
5
|
+
totalGas: BigNumber;
|
|
6
|
+
totalMilliGas: BigNumber;
|
|
7
|
+
totalStorage: BigNumber;
|
|
8
|
+
totalAllocationBurn: BigNumber;
|
|
9
|
+
totalOriginationBurn: BigNumber;
|
|
10
|
+
totalPaidStorageDiff: BigNumber;
|
|
11
|
+
totalStorageBurn: BigNumber;
|
|
12
|
+
}
|
|
13
|
+
export declare const receiptFromOperation: (op: OperationContentsAndResult[], { ALLOCATION_BURN, ORIGINATION_BURN }?: {
|
|
14
|
+
ALLOCATION_BURN: number;
|
|
15
|
+
ORIGINATION_BURN: number;
|
|
16
|
+
}) => Receipt;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BlockResponse, OperationContentsAndResultRegisterGlobalConstant, OperationContentsAndResultReveal } from '@tezos-x/octez.js-rpc';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { Context } from '../context';
|
|
4
|
+
import { WalletOperation, OperationStatus } from './operation';
|
|
5
|
+
export declare class RegisterGlobalConstantWalletOperation extends WalletOperation {
|
|
6
|
+
readonly opHash: string;
|
|
7
|
+
protected readonly context: Context;
|
|
8
|
+
constructor(opHash: string, context: Context, newHead$: Observable<BlockResponse>);
|
|
9
|
+
revealOperation(): Promise<OperationContentsAndResultReveal | undefined>;
|
|
10
|
+
registerGlobalConstantOperation(): Promise<OperationContentsAndResultRegisterGlobalConstant | undefined>;
|
|
11
|
+
status(): Promise<OperationStatus>;
|
|
12
|
+
globalConstantHash(): Promise<string | undefined>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WalletOperation, OperationStatus } from './operation';
|
|
2
|
+
import { Context } from '../context';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { BlockResponse, OperationContentsAndResultReveal, OperationContentsAndResultTransaction } from '@tezos-x/octez.js-rpc';
|
|
5
|
+
export declare class TransactionWalletOperation extends WalletOperation {
|
|
6
|
+
readonly opHash: string;
|
|
7
|
+
protected readonly context: Context;
|
|
8
|
+
constructor(opHash: string, context: Context, newHead$: Observable<BlockResponse>);
|
|
9
|
+
revealOperation(): Promise<OperationContentsAndResultReveal | undefined>;
|
|
10
|
+
transactionOperation(): Promise<OperationContentsAndResultTransaction | undefined>;
|
|
11
|
+
status(): Promise<OperationStatus>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WalletOperation, OperationStatus } from './operation';
|
|
2
|
+
import { Context } from '../context';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { BlockResponse, OperationContentsAndResultReveal, OperationContentsAndResultTransferTicket } from '@tezos-x/octez.js-rpc';
|
|
5
|
+
export declare class TransferTicketWalletOperation extends WalletOperation {
|
|
6
|
+
readonly opHash: string;
|
|
7
|
+
protected readonly context: Context;
|
|
8
|
+
constructor(opHash: string, context: Context, newHead$: Observable<BlockResponse>);
|
|
9
|
+
revealOperation(): Promise<OperationContentsAndResultReveal | undefined>;
|
|
10
|
+
transferTicketOperation(): Promise<OperationContentsAndResultTransferTicket | undefined>;
|
|
11
|
+
status(): Promise<OperationStatus>;
|
|
12
|
+
}
|