@agoric/orchestration 0.3.0-u23.0 → 0.3.0-u23.1
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/index.d.ts +9 -0
- package/package.json +15 -15
- package/src/axelar-types.d.ts +53 -0
- package/src/axelar-types.d.ts.map +1 -0
- package/src/cctp-chain-info.d.ts +65 -0
- package/src/cctp-chain-info.d.ts.map +1 -0
- package/src/chain-capabilities.d.ts +12 -0
- package/src/chain-capabilities.d.ts.map +1 -0
- package/src/chain-info.d.ts +10267 -0
- package/src/chain-info.d.ts.map +1 -0
- package/src/cosmos-api.d.ts +437 -0
- package/src/cosmos-api.d.ts.map +1 -0
- package/src/ethereum-api.d.ts +9 -0
- package/src/ethereum-api.d.ts.map +1 -0
- package/src/examples/auto-stake-it-tap-kit.d.ts +50 -0
- package/src/examples/auto-stake-it-tap-kit.d.ts.map +1 -0
- package/src/examples/auto-stake-it.contract.d.ts +34 -0
- package/src/examples/auto-stake-it.contract.d.ts.map +1 -0
- package/src/examples/auto-stake-it.flows.d.ts +24 -0
- package/src/examples/auto-stake-it.flows.d.ts.map +1 -0
- package/src/examples/axelar-gmp-account-kit.d.ts +80 -0
- package/src/examples/axelar-gmp-account-kit.d.ts.map +1 -0
- package/src/examples/axelar-gmp.contract.d.ts +52 -0
- package/src/examples/axelar-gmp.contract.d.ts.map +1 -0
- package/src/examples/axelar-gmp.flows.d.ts +21 -0
- package/src/examples/axelar-gmp.flows.d.ts.map +1 -0
- package/src/examples/basic-flows.contract.d.ts +32 -0
- package/src/examples/basic-flows.contract.d.ts.map +1 -0
- package/src/examples/basic-flows.flows.d.ts +20 -0
- package/src/examples/basic-flows.flows.d.ts.map +1 -0
- package/src/examples/send-anywhere.contract.d.ts +60 -0
- package/src/examples/send-anywhere.contract.d.ts.map +1 -0
- package/src/examples/send-anywhere.flows.d.ts +576 -0
- package/src/examples/send-anywhere.flows.d.ts.map +1 -0
- package/src/examples/shared.flows.d.ts +4 -0
- package/src/examples/shared.flows.d.ts.map +1 -0
- package/src/examples/stake-bld.contract.d.ts +237 -0
- package/src/examples/stake-bld.contract.d.ts.map +1 -0
- package/src/examples/stake-ica.contract.d.ts +573 -0
- package/src/examples/stake-ica.contract.d.ts.map +1 -0
- package/src/examples/staking-combinations.contract.d.ts +19 -0
- package/src/examples/staking-combinations.contract.d.ts.map +1 -0
- package/src/examples/staking-combinations.flows.d.ts +32 -0
- package/src/examples/staking-combinations.flows.d.ts.map +1 -0
- package/src/examples/swap-anything.contract.d.ts +55 -0
- package/src/examples/swap-anything.contract.d.ts.map +1 -0
- package/src/examples/swap-anything.flows.d.ts +32 -0
- package/src/examples/swap-anything.flows.d.ts.map +1 -0
- package/src/examples/swap.contract.d.ts +56 -0
- package/src/examples/swap.contract.d.ts.map +1 -0
- package/src/examples/swap.flows.d.ts +12 -0
- package/src/examples/swap.flows.d.ts.map +1 -0
- package/src/examples/unbond.contract.d.ts +21 -0
- package/src/examples/unbond.contract.d.ts.map +1 -0
- package/src/examples/unbond.flows.d.ts +6 -0
- package/src/examples/unbond.flows.d.ts.map +1 -0
- package/src/exos/chain-hub-admin.d.ts +27 -0
- package/src/exos/chain-hub-admin.d.ts.map +1 -0
- package/src/exos/chain-hub.d.ts +225 -0
- package/src/exos/chain-hub.d.ts.map +1 -0
- package/src/exos/combine-invitation-makers.d.ts +7 -0
- package/src/exos/combine-invitation-makers.d.ts.map +1 -0
- package/src/exos/cosmos-interchain-service.d.ts +49 -0
- package/src/exos/cosmos-interchain-service.d.ts.map +1 -0
- package/src/exos/cosmos-orchestration-account.d.ts +950 -0
- package/src/exos/cosmos-orchestration-account.d.ts.map +1 -0
- package/src/exos/exo-interfaces.d.ts +27 -0
- package/src/exos/exo-interfaces.d.ts.map +1 -0
- package/src/exos/ibc-packet.d.ts +101 -0
- package/src/exos/ibc-packet.d.ts.map +1 -0
- package/src/exos/ica-account-kit.d.ts +98 -0
- package/src/exos/ica-account-kit.d.ts.map +1 -0
- package/src/exos/icq-connection-kit.d.ts +67 -0
- package/src/exos/icq-connection-kit.d.ts.map +1 -0
- package/src/exos/local-chain-facade.d.ts +1587 -0
- package/src/exos/local-chain-facade.d.ts.map +1 -0
- package/src/exos/local-orchestration-account.d.ts +405 -0
- package/src/exos/local-orchestration-account.d.ts.map +1 -0
- package/src/exos/orchestrator.d.ts +35857 -0
- package/src/exos/orchestrator.d.ts.map +1 -0
- package/src/exos/packet-tools.d.ts +63 -0
- package/src/exos/packet-tools.d.ts.map +1 -0
- package/src/exos/portfolio-holder-kit.d.ts +154 -0
- package/src/exos/portfolio-holder-kit.d.ts.map +1 -0
- package/src/exos/remote-chain-facade.d.ts +1549 -0
- package/src/exos/remote-chain-facade.d.ts.map +1 -0
- package/src/facade.d.ts +33 -0
- package/src/facade.d.ts.map +1 -0
- package/src/fetched-chain-info.d.ts +10275 -0
- package/src/fetched-chain-info.d.ts.map +1 -0
- package/src/fixtures/query-flows.contract.d.ts +33 -0
- package/src/fixtures/query-flows.contract.d.ts.map +1 -0
- package/src/fixtures/query-flows.flows.d.ts +20 -0
- package/src/fixtures/query-flows.flows.d.ts.map +1 -0
- package/src/orchestration-api.d.ts +315 -0
- package/src/orchestration-api.d.ts.map +1 -0
- package/src/typeGuards.d.ts +163 -0
- package/src/typeGuards.d.ts.map +1 -0
- package/src/types.d.ts +25 -0
- package/src/types.d.ts.map +1 -0
- package/src/utils/abitype.d.ts +6 -0
- package/src/utils/abitype.d.ts.map +1 -0
- package/src/utils/address.d.ts +44 -0
- package/src/utils/address.d.ts.map +1 -0
- package/src/utils/agd-lib.d.ts +58 -0
- package/src/utils/agd-lib.d.ts.map +1 -0
- package/src/utils/amounts.d.ts +11 -0
- package/src/utils/amounts.d.ts.map +1 -0
- package/src/utils/asset.d.ts +6 -0
- package/src/utils/asset.d.ts.map +1 -0
- package/src/utils/axelar-static-config.d.ts +34 -0
- package/src/utils/axelar-static-config.d.ts.map +1 -0
- package/src/utils/chain-hub-helper.d.ts +14 -0
- package/src/utils/chain-hub-helper.d.ts.map +1 -0
- package/src/utils/chain-info.d.ts +5 -0
- package/src/utils/chain-info.d.ts.map +1 -0
- package/src/utils/codecs.d.ts +145 -0
- package/src/utils/codecs.d.ts.map +1 -0
- package/src/utils/cosmos.d.ts +61 -0
- package/src/utils/cosmos.d.ts.map +1 -0
- package/src/utils/denomHash.d.ts +7 -0
- package/src/utils/denomHash.d.ts.map +1 -0
- package/src/utils/exo-helpers.d.ts +156 -0
- package/src/utils/exo-helpers.d.ts.map +1 -0
- package/src/utils/gmp.d.ts +30 -0
- package/src/utils/gmp.d.ts.map +1 -0
- package/src/utils/orc.d.ts +17 -0
- package/src/utils/orc.d.ts.map +1 -0
- package/src/utils/orchestrationAccount.d.ts +91 -0
- package/src/utils/orchestrationAccount.d.ts.map +1 -0
- package/src/utils/packet.d.ts +57 -0
- package/src/utils/packet.d.ts.map +1 -0
- package/src/utils/permit2/signatureTransfer.d.ts +221 -0
- package/src/utils/permit2/signatureTransfer.d.ts.map +1 -0
- package/src/utils/permit2/signatureTransferHelpers.d.ts +334 -0
- package/src/utils/permit2/signatureTransferHelpers.d.ts.map +1 -0
- package/src/utils/permit2.d.ts +11 -0
- package/src/utils/permit2.d.ts.map +1 -0
- package/src/utils/progress.d.ts +41 -0
- package/src/utils/progress.d.ts.map +1 -0
- package/src/utils/registry.d.ts +6 -0
- package/src/utils/registry.d.ts.map +1 -0
- package/src/utils/start-helper.d.ts +129 -0
- package/src/utils/start-helper.d.ts.map +1 -0
- package/src/utils/time.d.ts +38 -0
- package/src/utils/time.d.ts.map +1 -0
- package/src/utils/viem-utils/hashTypedData.d.ts +21 -0
- package/src/utils/viem-utils/hashTypedData.d.ts.map +1 -0
- package/src/utils/viem-utils/types.d.ts +6 -0
- package/src/utils/viem-utils/types.d.ts.map +1 -0
- package/src/utils/viem.d.ts +11 -0
- package/src/utils/viem.d.ts.map +1 -0
- package/src/utils/zcf-tools.d.ts +19 -0
- package/src/utils/zcf-tools.d.ts.map +1 -0
- package/src/utils/zoe-tools.d.ts +19 -0
- package/src/utils/zoe-tools.d.ts.map +1 -0
- package/src/vat-orchestration.d.ts +21 -0
- package/src/vat-orchestration.d.ts.map +1 -0
- package/tools/contract-tests.d.ts +1832 -0
- package/tools/contract-tests.d.ts.map +1 -0
- package/tools/ibc-mock-fixtures.d.ts +49 -0
- package/tools/ibc-mock-fixtures.d.ts.map +1 -0
- package/tools/ibc-mocks.d.ts +168 -0
- package/tools/ibc-mocks.d.ts.map +1 -0
- package/tools/make-test-address.d.ts +3 -0
- package/tools/make-test-address.d.ts.map +1 -0
- package/tools/network-fakes.d.ts +143 -0
- package/tools/network-fakes.d.ts.map +1 -0
- package/tools/protobuf-decoder.d.ts +19 -0
- package/tools/protobuf-decoder.d.ts.map +1 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {TypedPattern} from '@agoric/internal';
|
|
3
|
+
* @import {IBCEndpoint, IBCConnectionInfo} from '@agoric/network/ibc';
|
|
4
|
+
* @import {CaipChainId, TrafficEntry} from '../types.js';
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {object} SliceDescriptor
|
|
8
|
+
* @property {number} start beginning index of the range (inclusive)
|
|
9
|
+
* @property {number} end ending index of the range (exclusive)
|
|
10
|
+
*/
|
|
11
|
+
/** @type {TypedPattern<SliceDescriptor>} */
|
|
12
|
+
export const SliceDescriptorShape: TypedPattern<SliceDescriptor>;
|
|
13
|
+
export namespace orchestrationAccountMethods {
|
|
14
|
+
let getAddress: import("@endo/patterns").MethodGuard;
|
|
15
|
+
let getBalance: import("@endo/patterns").MethodGuard;
|
|
16
|
+
let getBalances: import("@endo/patterns").MethodGuard;
|
|
17
|
+
let send: import("@endo/patterns").MethodGuard;
|
|
18
|
+
let sendAll: import("@endo/patterns").MethodGuard;
|
|
19
|
+
let transfer: import("@endo/patterns").MethodGuard;
|
|
20
|
+
let transferSteps: import("@endo/patterns").MethodGuard;
|
|
21
|
+
let asContinuingOffer: import("@endo/patterns").MethodGuard;
|
|
22
|
+
let getPublicTopics: import("@endo/patterns").MethodGuard;
|
|
23
|
+
let makeProgressTracker: import("@endo/patterns").MethodGuard;
|
|
24
|
+
}
|
|
25
|
+
export namespace trafficTransforms {
|
|
26
|
+
namespace IbcTransfer {
|
|
27
|
+
export { startIbcTransfer as start };
|
|
28
|
+
export { finishIbcTransfer as finish };
|
|
29
|
+
}
|
|
30
|
+
namespace IbcICA {
|
|
31
|
+
export { startIbcICA as start };
|
|
32
|
+
export { finishIbcICA as finish };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export function addTrafficEntries(priorTraffic: TrafficEntry[] | undefined, newEntries: TrafficEntry[]): {
|
|
36
|
+
traffic: TrafficEntry[];
|
|
37
|
+
slice: SliceDescriptor;
|
|
38
|
+
};
|
|
39
|
+
export function finishTrafficEntries(priorTraffic: TrafficEntry[] | undefined, sliceDescriptor: SliceDescriptor | undefined, finisher: (entries: TrafficEntry[]) => TrafficEntry[]): TrafficEntry[];
|
|
40
|
+
export type SliceDescriptor = {
|
|
41
|
+
/**
|
|
42
|
+
* beginning index of the range (inclusive)
|
|
43
|
+
*/
|
|
44
|
+
start: number;
|
|
45
|
+
/**
|
|
46
|
+
* ending index of the range (exclusive)
|
|
47
|
+
*/
|
|
48
|
+
end: number;
|
|
49
|
+
};
|
|
50
|
+
import type { TypedPattern } from '@agoric/internal';
|
|
51
|
+
/**
|
|
52
|
+
* @param {CaipChainId} srcChain
|
|
53
|
+
* @param {CaipChainId} dstChain
|
|
54
|
+
* @param {IBCConnectionInfo['transferChannel']} ibcChannel
|
|
55
|
+
* @returns {(TrafficEntry<'ibc'> & { incomplete: true })[]}
|
|
56
|
+
*/
|
|
57
|
+
declare function startIbcTransfer(srcChain: CaipChainId, dstChain: CaipChainId, ibcChannel: IBCConnectionInfo["transferChannel"]): (TrafficEntry<"ibc"> & {
|
|
58
|
+
incomplete: true;
|
|
59
|
+
})[];
|
|
60
|
+
/**
|
|
61
|
+
* @param {(TrafficEntry<'ibc'> & { incomplete?: any })[]} entries
|
|
62
|
+
* @param {TrafficEntry<'ibc'>['seq']} sequence
|
|
63
|
+
* @returns {TrafficEntry<'ibc'>[]}
|
|
64
|
+
*/
|
|
65
|
+
declare function finishIbcTransfer(entries: (TrafficEntry<"ibc"> & {
|
|
66
|
+
incomplete?: any;
|
|
67
|
+
})[], sequence: TrafficEntry<"ibc">["seq"]): TrafficEntry<"ibc">[];
|
|
68
|
+
/**
|
|
69
|
+
* @param {CaipChainId} dstChain
|
|
70
|
+
* @returns {(TrafficEntry<'ibc'> & { incomplete: true })[]}
|
|
71
|
+
*/
|
|
72
|
+
declare function startIbcICA(dstChain: CaipChainId): (TrafficEntry<"ibc"> & {
|
|
73
|
+
incomplete: true;
|
|
74
|
+
})[];
|
|
75
|
+
/**
|
|
76
|
+
* @param {(TrafficEntry<'ibc'> & { incomplete?: any })[]} entries
|
|
77
|
+
* @param {CaipChainId} srcChain
|
|
78
|
+
* @param {Pick<IBCEndpoint, 'portID' | 'channelID'>} srcEndpoint
|
|
79
|
+
* @param {Pick<IBCEndpoint, 'portID' | 'channelID'>} dstEndpoint
|
|
80
|
+
* @param {TrafficEntry<'ibc'>['seq']} sequence
|
|
81
|
+
* @returns {TrafficEntry<'ibc'>[]}
|
|
82
|
+
*/
|
|
83
|
+
declare function finishIbcICA(entries: (TrafficEntry<"ibc"> & {
|
|
84
|
+
incomplete?: any;
|
|
85
|
+
})[], srcChain: CaipChainId, srcEndpoint: Pick<IBCEndpoint, "portID" | "channelID">, dstEndpoint: Pick<IBCEndpoint, "portID" | "channelID">, sequence: TrafficEntry<"ibc">["seq"]): TrafficEntry<"ibc">[];
|
|
86
|
+
import type { TrafficEntry } from '../types.js';
|
|
87
|
+
import type { CaipChainId } from '../types.js';
|
|
88
|
+
import type { IBCConnectionInfo } from '@agoric/network/ibc';
|
|
89
|
+
import type { IBCEndpoint } from '@agoric/network/ibc';
|
|
90
|
+
export {};
|
|
91
|
+
//# sourceMappingURL=orchestrationAccount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrationAccount.d.ts","sourceRoot":"","sources":["orchestrationAccount.js"],"names":[],"mappings":"AAgBA;;;;GAIG;AAEH;;;;GAIG;AACH,4CAA4C;AAC5C,mCADW,aAAa,eAAe,CAAC,CAIrC;;;;;;;;;;;;;;;;;;;;;;;AA8KI,gDAJI,YAAY,EAAE,GAAG,SAAS,cAC1B,YAAY,EAAE,GACZ;IAAE,OAAO,EAAE,YAAY,EAAE,CAAC;IAAC,KAAK,EAAE,eAAe,CAAA;CAAE,CAa/D;AASM,mDALI,YAAY,EAAE,GAAG,SAAS,mBAC1B,eAAe,GAAG,SAAS,YAC3B,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,GACzC,YAAY,EAAE,CAoB1B;;;;;WA3Na,MAAM;;;;SACN,MAAM;;kCARW,kBAAkB;AA6CjD;;;;;GAKG;AACH,4CALW,WAAW,YACX,WAAW,cACX,iBAAiB,CAAC,iBAAiB,CAAC,GAClC,CAAC,aAAa,KAAK,CAAC,GAAG;IAAE,UAAU,EAAE,IAAI,CAAA;CAAE,CAAC,EAAE,CAqBvD;AAoBJ;;;;GAIG;AACH,4CAJW,CAAC,aAAa,KAAK,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,GAAG,CAAA;CAAE,CAAC,EAAE,YAC9C,aAAa,KAAK,CAAN,CAAQ,KAAK,CAAC,GACxB,aAAa,KAAK,CAAC,EAAE,CAYjC;AAED;;;GAGG;AACH,uCAHW,WAAW,GACT,CAAC,aAAa,KAAK,CAAC,GAAG;IAAE,UAAU,EAAE,IAAI,CAAA;CAAE,CAAC,EAAE,CAYvD;AAEJ;;;;;;;GAOG;AACH,uCAPW,CAAC,aAAa,KAAK,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,GAAG,CAAA;CAAE,CAAC,EAAE,YAC9C,WAAW,eACX,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,WAAW,CAAC,eACzC,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,WAAW,CAAC,YACzC,aAAa,KAAK,CAAN,CAAQ,KAAK,CAAC,GACxB,aAAa,KAAK,CAAC,EAAE,CAwCjC;kCAvK2C,aAAa;iCAAb,aAAa;uCADR,qBAAqB;iCAArB,qBAAqB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {AnyJson, JsonSafe} from '@agoric/cosmic-proto';
|
|
3
|
+
* @import {InterchainAccountPacketData} from '@agoric/cosmic-proto/ibc/applications/interchain_accounts/v1/packet.js';
|
|
4
|
+
* @import {InterchainQueryPacketData} from '@agoric/cosmic-proto/icq/v1/packet.js';
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Makes an IBC transaction packet from an array of messages. Expects the
|
|
8
|
+
* `value` of each message to be base64 encoded bytes. Skips checks for
|
|
9
|
+
* malformed messages in favor of interface guards.
|
|
10
|
+
*
|
|
11
|
+
* @param {AnyJson[]} msgs
|
|
12
|
+
* @param {Partial<Omit<TxBodyType, 'messages'>>} [opts]
|
|
13
|
+
* @returns {string} stringified InterchainAccountPacketData
|
|
14
|
+
* @throws {Error} if malformed messages are provided
|
|
15
|
+
*/
|
|
16
|
+
export function makeTxPacket(msgs: AnyJson[], opts?: Partial<Omit<TxBodyType, "messages">>): string;
|
|
17
|
+
/**
|
|
18
|
+
* Makes an IBC query packet from an array of query messages. Expects the `data`
|
|
19
|
+
* of each message to be base64 encoded bytes. Skips checks for malformed
|
|
20
|
+
* messages in favor of interface guards.
|
|
21
|
+
*
|
|
22
|
+
* @param {JsonSafe<RequestQueryType>[]} msgs
|
|
23
|
+
* @returns {string} stringified InterchainQueryPacketData
|
|
24
|
+
* @throws {Error} if malformed messages are provided
|
|
25
|
+
*/
|
|
26
|
+
export function makeQueryPacket(msgs: JsonSafe<RequestQueryType>[]): string;
|
|
27
|
+
/**
|
|
28
|
+
* Looks for a result or error key in the response string, and returns a
|
|
29
|
+
* Base64Bytes string. This string can be decoded using the corresponding
|
|
30
|
+
* Msg*Response object. Error strings seem to be plain text and do not need
|
|
31
|
+
* decoding.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} response
|
|
34
|
+
* @returns {string} - base64 encoded bytes string
|
|
35
|
+
* @throws {Error} if error key is detected in response string, or result key is
|
|
36
|
+
* not found
|
|
37
|
+
*/
|
|
38
|
+
export function parseTxPacket(response: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Looks for a result or error key in the response string. If a result is found,
|
|
41
|
+
* `responses` is decoded via `CosmosResponse`. The `key` and `value` fields on
|
|
42
|
+
* the resulting entries are base64 encoded for inter-vat communication. These
|
|
43
|
+
* can be decoded using the corresponding Query*Response objects. Error strings
|
|
44
|
+
* seem to be plain text and do not need decoding.
|
|
45
|
+
*
|
|
46
|
+
* @param {string} response
|
|
47
|
+
* @returns {JsonSafe<ResponseQueryType>[]}
|
|
48
|
+
* @throws {Error} if error key is detected in response string, or result key is
|
|
49
|
+
* not found
|
|
50
|
+
*/
|
|
51
|
+
export function parseQueryPacket(response: string): JsonSafe<ResponseQueryType>[];
|
|
52
|
+
import type { AnyJson } from '@agoric/cosmic-proto';
|
|
53
|
+
import { TxBody as TxBodyType } from '@agoric/cosmic-proto/cosmos/tx/v1beta1/tx.js';
|
|
54
|
+
import { RequestQuery as RequestQueryType } from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
55
|
+
import type { JsonSafe } from '@agoric/cosmic-proto';
|
|
56
|
+
import { ResponseQuery as ResponseQueryType } from '@agoric/cosmic-proto/tendermint/abci/types.js';
|
|
57
|
+
//# sourceMappingURL=packet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packet.d.ts","sourceRoot":"","sources":["packet.js"],"names":[],"mappings":"AAsBA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,mCALW,OAAO,EAAE,SACT,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,GACnC,MAAM,CAsBlB;AAGD;;;;;;;;GAQG;AACH,sCAJW,SAAS,gBAAgB,CAAC,EAAE,GAC1B,MAAM,CAgBlB;AAGD;;;;;;;;;;GAUG;AACH,wCALW,MAAM,GACJ,MAAM,CASlB;AAGD;;;;;;;;;;;GAWG;AACH,2CALW,MAAM,GACJ,SAAS,iBAAiB,CAAC,EAAE,CASzC;6BAlGmC,sBAAsB;qCAtBrB,8CAA8C;iDAK5E,+CAA+C;8BAiBlB,sBAAsB;mDAjBnD,+CAA+C"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Signature transfer permit2 types and utilities
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* Copyright (c) 2021 Uniswap Lab
|
|
6
|
+
* Copied and adapted from https://github.com/Uniswap/sdks/blob/de28419fcae6e6ba6f88e4a4ae46b2fc9d226cd6/sdks/permit2-sdk/src/signatureTransfer.ts
|
|
7
|
+
*
|
|
8
|
+
* The modifications made are to generalize the witness type to allow defining the field name,
|
|
9
|
+
* and use viem types instead of ethers types.
|
|
10
|
+
*
|
|
11
|
+
* Some stylistic changes have also been made to conform to our code style.
|
|
12
|
+
*/
|
|
13
|
+
import type { TypedDataToPrimitiveTypes } from 'abitype';
|
|
14
|
+
import type { Address, TypedData, TypedDataDefinition } from 'viem';
|
|
15
|
+
import type { TypedDataParameter } from '../abitype.js';
|
|
16
|
+
interface WitnessDefinition<T extends TypedData = TypedData, TD extends TypedDataParameter<string, Extract<keyof T, string>> = TypedDataParameter<'witness', Extract<keyof T, string>>> {
|
|
17
|
+
witnessField: TD;
|
|
18
|
+
witnessTypes: T;
|
|
19
|
+
}
|
|
20
|
+
export interface Witness<T extends TypedData = TypedData, TD extends TypedDataParameter<string, Extract<keyof T, string>> = TypedDataParameter<'witness', Extract<keyof T, string>>> extends WitnessDefinition<T, TD> {
|
|
21
|
+
witness: TypedDataToPrimitiveTypes<T>[TD['type']];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Helper to help caller check that the `data` matches the inferred witness types
|
|
25
|
+
*
|
|
26
|
+
* @see {@link https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-4.html#the-noinfer-utility-type}
|
|
27
|
+
*/
|
|
28
|
+
export declare function makeWitness<T extends TypedData, TD extends TypedDataParameter<string, Extract<keyof T, string>>>(data: NoInfer<TypedDataToPrimitiveTypes<T>[TD['type']]>, types: T, typeParam: TD): Witness<T, TD>;
|
|
29
|
+
export type TokenPermissions = {
|
|
30
|
+
token: Address;
|
|
31
|
+
amount: bigint;
|
|
32
|
+
};
|
|
33
|
+
export type PermitTransferFrom = {
|
|
34
|
+
permitted: TokenPermissions;
|
|
35
|
+
spender: Address;
|
|
36
|
+
nonce: bigint;
|
|
37
|
+
deadline: bigint;
|
|
38
|
+
};
|
|
39
|
+
export type PermitBatchTransferFrom = {
|
|
40
|
+
permitted: readonly TokenPermissions[];
|
|
41
|
+
spender: Address;
|
|
42
|
+
nonce: bigint;
|
|
43
|
+
deadline: bigint;
|
|
44
|
+
};
|
|
45
|
+
export declare const PermitTransferFromTypeParams: [{
|
|
46
|
+
readonly name: "permitted";
|
|
47
|
+
readonly type: "TokenPermissions";
|
|
48
|
+
}, {
|
|
49
|
+
readonly name: "spender";
|
|
50
|
+
readonly type: "address";
|
|
51
|
+
}, {
|
|
52
|
+
readonly name: "nonce";
|
|
53
|
+
readonly type: "uint256";
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "deadline";
|
|
56
|
+
readonly type: "uint256";
|
|
57
|
+
}];
|
|
58
|
+
export declare const PermitBatchTransferFromTypeParams: [{
|
|
59
|
+
readonly name: "permitted";
|
|
60
|
+
readonly type: "TokenPermissions[]";
|
|
61
|
+
}, {
|
|
62
|
+
readonly name: "spender";
|
|
63
|
+
readonly type: "address";
|
|
64
|
+
}, {
|
|
65
|
+
readonly name: "nonce";
|
|
66
|
+
readonly type: "uint256";
|
|
67
|
+
}, {
|
|
68
|
+
readonly name: "deadline";
|
|
69
|
+
readonly type: "uint256";
|
|
70
|
+
}];
|
|
71
|
+
export declare const PermitTransferFromTypes: {
|
|
72
|
+
readonly EIP712Domain: [{
|
|
73
|
+
readonly name: "name";
|
|
74
|
+
readonly type: "string";
|
|
75
|
+
}, {
|
|
76
|
+
readonly name: "chainId";
|
|
77
|
+
readonly type: "uint256";
|
|
78
|
+
}, {
|
|
79
|
+
readonly name: "verifyingContract";
|
|
80
|
+
readonly type: "address";
|
|
81
|
+
}];
|
|
82
|
+
readonly PermitTransferFrom: [{
|
|
83
|
+
readonly name: "permitted";
|
|
84
|
+
readonly type: "TokenPermissions";
|
|
85
|
+
}, {
|
|
86
|
+
readonly name: "spender";
|
|
87
|
+
readonly type: "address";
|
|
88
|
+
}, {
|
|
89
|
+
readonly name: "nonce";
|
|
90
|
+
readonly type: "uint256";
|
|
91
|
+
}, {
|
|
92
|
+
readonly name: "deadline";
|
|
93
|
+
readonly type: "uint256";
|
|
94
|
+
}];
|
|
95
|
+
readonly TokenPermissions: [{
|
|
96
|
+
readonly name: "token";
|
|
97
|
+
readonly type: "address";
|
|
98
|
+
}, {
|
|
99
|
+
readonly name: "amount";
|
|
100
|
+
readonly type: "uint256";
|
|
101
|
+
}];
|
|
102
|
+
};
|
|
103
|
+
export declare const PermitBatchTransferFromTypes: {
|
|
104
|
+
readonly EIP712Domain: [{
|
|
105
|
+
readonly name: "name";
|
|
106
|
+
readonly type: "string";
|
|
107
|
+
}, {
|
|
108
|
+
readonly name: "chainId";
|
|
109
|
+
readonly type: "uint256";
|
|
110
|
+
}, {
|
|
111
|
+
readonly name: "verifyingContract";
|
|
112
|
+
readonly type: "address";
|
|
113
|
+
}];
|
|
114
|
+
readonly PermitBatchTransferFrom: [{
|
|
115
|
+
readonly name: "permitted";
|
|
116
|
+
readonly type: "TokenPermissions[]";
|
|
117
|
+
}, {
|
|
118
|
+
readonly name: "spender";
|
|
119
|
+
readonly type: "address";
|
|
120
|
+
}, {
|
|
121
|
+
readonly name: "nonce";
|
|
122
|
+
readonly type: "uint256";
|
|
123
|
+
}, {
|
|
124
|
+
readonly name: "deadline";
|
|
125
|
+
readonly type: "uint256";
|
|
126
|
+
}];
|
|
127
|
+
readonly TokenPermissions: [{
|
|
128
|
+
readonly name: "token";
|
|
129
|
+
readonly type: "address";
|
|
130
|
+
}, {
|
|
131
|
+
readonly name: "amount";
|
|
132
|
+
readonly type: "uint256";
|
|
133
|
+
}];
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Generate an EIP-712 `types` record for a single-token
|
|
137
|
+
* `permitWitnessTransferFrom` call.
|
|
138
|
+
*/
|
|
139
|
+
export declare function permitWitnessTransferFromTypes<T extends TypedData, TD extends TypedDataParameter<string, Extract<keyof T, string>> = TypedDataParameter<'witness', Extract<keyof T, string>>>(witness: WitnessDefinition<T, TD>): {
|
|
140
|
+
readonly EIP712Domain: [{
|
|
141
|
+
readonly name: "name";
|
|
142
|
+
readonly type: "string";
|
|
143
|
+
}, {
|
|
144
|
+
readonly name: "chainId";
|
|
145
|
+
readonly type: "uint256";
|
|
146
|
+
}, {
|
|
147
|
+
readonly name: "verifyingContract";
|
|
148
|
+
readonly type: "address";
|
|
149
|
+
}];
|
|
150
|
+
readonly PermitWitnessTransferFrom: readonly [{
|
|
151
|
+
readonly name: "permitted";
|
|
152
|
+
readonly type: "TokenPermissions";
|
|
153
|
+
}, {
|
|
154
|
+
readonly name: "spender";
|
|
155
|
+
readonly type: "address";
|
|
156
|
+
}, {
|
|
157
|
+
readonly name: "nonce";
|
|
158
|
+
readonly type: "uint256";
|
|
159
|
+
}, {
|
|
160
|
+
readonly name: "deadline";
|
|
161
|
+
readonly type: "uint256";
|
|
162
|
+
}, TD];
|
|
163
|
+
readonly TokenPermissions: [{
|
|
164
|
+
readonly name: "token";
|
|
165
|
+
readonly type: "address";
|
|
166
|
+
}, {
|
|
167
|
+
readonly name: "amount";
|
|
168
|
+
readonly type: "uint256";
|
|
169
|
+
}];
|
|
170
|
+
} & T;
|
|
171
|
+
/**
|
|
172
|
+
* Generate an EIP-712 `types` record for a multi-token
|
|
173
|
+
* `permitWitnessTransferFrom` call.
|
|
174
|
+
*/
|
|
175
|
+
export declare function permitBatchWitnessTransferFromTypes<T extends TypedData, TD extends TypedDataParameter<string, Extract<keyof T, string>> = TypedDataParameter<'witness', Extract<keyof T, string>>>(witness: WitnessDefinition<T, TD>): {
|
|
176
|
+
readonly EIP712Domain: [{
|
|
177
|
+
readonly name: "name";
|
|
178
|
+
readonly type: "string";
|
|
179
|
+
}, {
|
|
180
|
+
readonly name: "chainId";
|
|
181
|
+
readonly type: "uint256";
|
|
182
|
+
}, {
|
|
183
|
+
readonly name: "verifyingContract";
|
|
184
|
+
readonly type: "address";
|
|
185
|
+
}];
|
|
186
|
+
readonly PermitBatchWitnessTransferFrom: readonly [{
|
|
187
|
+
readonly name: "permitted";
|
|
188
|
+
readonly type: "TokenPermissions[]";
|
|
189
|
+
}, {
|
|
190
|
+
readonly name: "spender";
|
|
191
|
+
readonly type: "address";
|
|
192
|
+
}, {
|
|
193
|
+
readonly name: "nonce";
|
|
194
|
+
readonly type: "uint256";
|
|
195
|
+
}, {
|
|
196
|
+
readonly name: "deadline";
|
|
197
|
+
readonly type: "uint256";
|
|
198
|
+
}, TD];
|
|
199
|
+
readonly TokenPermissions: [{
|
|
200
|
+
readonly name: "token";
|
|
201
|
+
readonly type: "address";
|
|
202
|
+
}, {
|
|
203
|
+
readonly name: "amount";
|
|
204
|
+
readonly type: "uint256";
|
|
205
|
+
}];
|
|
206
|
+
} & T;
|
|
207
|
+
export type PermitWitnessTransferFrom<T extends Record<string, unknown>, TN extends string = 'witness'> = PermitTransferFrom & {
|
|
208
|
+
[key in TN]: T;
|
|
209
|
+
};
|
|
210
|
+
export type PermitBatchWitnessTransferFrom<T extends Record<string, unknown>, TN extends string = 'witness'> = PermitBatchTransferFrom & {
|
|
211
|
+
[key in TN]: T;
|
|
212
|
+
};
|
|
213
|
+
export declare function permit2Domain(permit2Address: Address, chainId: number | bigint): {
|
|
214
|
+
readonly name: "Permit2";
|
|
215
|
+
readonly chainId: number | bigint;
|
|
216
|
+
readonly verifyingContract: `0x${string}`;
|
|
217
|
+
};
|
|
218
|
+
export declare function getPermitWitnessTransferFromData<T extends TypedData, TD extends TypedDataParameter<string, Extract<keyof T, string>> = TypedDataParameter<'witness', Extract<keyof T, string>>>(permit: PermitTransferFrom, permit2Address: Address, chainId: number | bigint, witness: Witness<T, TD>): TypedDataDefinition<ReturnType<typeof permitWitnessTransferFromTypes<T, TD>>, 'PermitWitnessTransferFrom', 'PermitWitnessTransferFrom'>;
|
|
219
|
+
export declare function getPermitBatchWitnessTransferFromData<T extends TypedData, TD extends TypedDataParameter<string, Extract<keyof T, string>> = TypedDataParameter<'witness', Extract<keyof T, string>>>(permit: PermitBatchTransferFrom, permit2Address: Address, chainId: number | bigint, witness: Witness<T, TD>): TypedDataDefinition<ReturnType<typeof permitBatchWitnessTransferFromTypes<T, TD>>, 'PermitBatchWitnessTransferFrom', 'PermitBatchWitnessTransferFrom'>;
|
|
220
|
+
export {};
|
|
221
|
+
//# sourceMappingURL=signatureTransfer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signatureTransfer.d.ts","sourceRoot":"","sources":["signatureTransfer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,mBAAmB,EAEpB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAKxD,UAAU,iBAAiB,CACzB,CAAC,SAAS,SAAS,GAAG,SAAS,EAC/B,EAAE,SAAS,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC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