@layerzerolabs/oft-v2-solana-sdk 3.0.46 → 3.0.48
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/CHANGELOG.md +20 -0
- package/deployments/solana-sandbox-local/{TokenOneOFT.json → 302/TokenOneOFT.json} +5 -4
- package/deployments/solana-sandbox-local/{TokenThreeOFT.json → 302/TokenThreeOFT.json} +5 -4
- package/deployments/solana-sandbox-local/{TokenTwoOFTAdapter.json → 302/TokenTwoOFTAdapter.json} +5 -4
- package/deployments/solana-testnet/202/TokenOneOFT.json +16 -0
- package/dist/index.cjs +2101 -266
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1349 -269
- package/dist/index.d.ts +1349 -269
- package/dist/index.mjs +2099 -260
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -9
- package/src/consts.ts +5 -0
- package/src/generated/{accounts → oft202/accounts}/lzReceiveTypesAccounts.ts +1 -2
- package/src/generated/{accounts → oft202/accounts}/oFTStore.ts +1 -2
- package/src/generated/oft202/accounts/peerConfig.ts +178 -0
- package/src/generated/oft202/instructions/index.ts +18 -0
- package/src/generated/{instructions → oft202/instructions}/initOft.ts +1 -2
- package/src/generated/{instructions → oft202/instructions}/lzReceive.ts +1 -2
- package/src/generated/{instructions → oft202/instructions}/lzReceiveTypes.ts +1 -2
- package/src/generated/{instructions → oft202/instructions}/quoteOft.ts +1 -2
- package/src/generated/oft202/instructions/quoteSend.ts +149 -0
- package/src/generated/oft202/instructions/send.ts +193 -0
- package/src/generated/{instructions → oft202/instructions}/setOftConfig.ts +1 -2
- package/src/generated/{instructions → oft202/instructions}/setPause.ts +1 -2
- package/src/generated/{instructions → oft202/instructions}/setPeerConfig.ts +1 -2
- package/src/generated/{instructions → oft202/instructions}/withdrawFee.ts +1 -2
- package/src/generated/{programs → oft202/programs}/oft.ts +2 -2
- package/src/generated/oft202/types/composeParams.ts +35 -0
- package/src/generated/oft202/types/index.ts +22 -0
- package/src/generated/oft202/types/peerConfigParam.ts +143 -0
- package/src/generated/oft302/accounts/index.ts +11 -0
- package/src/generated/oft302/accounts/lzReceiveTypesAccounts.ts +167 -0
- package/src/generated/oft302/accounts/oFTStore.ts +198 -0
- package/src/generated/{accounts → oft302/accounts}/peerConfig.ts +1 -2
- package/src/generated/oft302/errors/index.ts +9 -0
- package/src/generated/oft302/errors/oft.ts +159 -0
- package/src/generated/oft302/index.ts +14 -0
- package/src/generated/oft302/instructions/initOft.ts +179 -0
- package/src/generated/oft302/instructions/lzReceive.ts +203 -0
- package/src/generated/oft302/instructions/lzReceiveTypes.ts +124 -0
- package/src/generated/{instructions → oft302/instructions}/oftVersion.ts +1 -2
- package/src/generated/oft302/instructions/quoteOft.ts +144 -0
- package/src/generated/{instructions → oft302/instructions}/quoteSend.ts +1 -2
- package/src/generated/{instructions → oft302/instructions}/send.ts +1 -2
- package/src/generated/oft302/instructions/setOftConfig.ts +124 -0
- package/src/generated/oft302/instructions/setPause.ts +119 -0
- package/src/generated/oft302/instructions/setPeerConfig.ts +148 -0
- package/src/generated/oft302/instructions/withdrawFee.ts +151 -0
- package/src/generated/oft302/programs/index.ts +9 -0
- package/src/generated/oft302/programs/oft.ts +47 -0
- package/src/generated/oft302/shared/index.ts +117 -0
- package/src/generated/oft302/types/enforcedOptions.ts +31 -0
- package/src/generated/oft302/types/lzAccount.ts +35 -0
- package/src/generated/oft302/types/lzReceiveParams.ts +50 -0
- package/src/generated/oft302/types/messagingFee.ts +29 -0
- package/src/generated/oft302/types/oFTFeeDetail.ts +34 -0
- package/src/generated/oft302/types/oFTLimits.ts +26 -0
- package/src/generated/oft302/types/oFTReceipt.ts +29 -0
- package/src/generated/oft302/types/oFTType.ts +23 -0
- package/src/generated/oft302/types/quoteOFTResult.ts +50 -0
- package/src/generated/oft302/types/rateLimitParams.ts +38 -0
- package/src/generated/oft302/types/rateLimiter.ts +38 -0
- package/src/generated/oft302/types/setOFTConfigParams.ts +124 -0
- package/src/index.ts +5 -46
- package/src/oft202.ts +618 -0
- package/src/{oft.ts → oft302.ts} +54 -55
- package/src/pda.ts +34 -0
- package/src/types.ts +40 -0
- /package/src/generated/{accounts → oft202/accounts}/index.ts +0 -0
- /package/src/generated/{errors → oft202/errors}/index.ts +0 -0
- /package/src/generated/{errors → oft202/errors}/oft.ts +0 -0
- /package/src/generated/{index.ts → oft202/index.ts} +0 -0
- /package/src/generated/{programs → oft202/programs}/index.ts +0 -0
- /package/src/generated/{shared → oft202/shared}/index.ts +0 -0
- /package/src/generated/{types → oft202/types}/enforcedOptions.ts +0 -0
- /package/src/generated/{types → oft202/types}/lzAccount.ts +0 -0
- /package/src/generated/{types → oft202/types}/lzReceiveParams.ts +0 -0
- /package/src/generated/{types → oft202/types}/messagingFee.ts +0 -0
- /package/src/generated/{types → oft202/types}/oFTFeeDetail.ts +0 -0
- /package/src/generated/{types → oft202/types}/oFTLimits.ts +0 -0
- /package/src/generated/{types → oft202/types}/oFTReceipt.ts +0 -0
- /package/src/generated/{types → oft202/types}/oFTType.ts +0 -0
- /package/src/generated/{types → oft202/types}/quoteOFTResult.ts +0 -0
- /package/src/generated/{types → oft202/types}/rateLimitParams.ts +0 -0
- /package/src/generated/{types → oft202/types}/rateLimiter.ts +0 -0
- /package/src/generated/{types → oft202/types}/setOFTConfigParams.ts +0 -0
- /package/src/generated/{instructions → oft302/instructions}/index.ts +0 -0
- /package/src/generated/{types → oft302/types}/index.ts +0 -0
- /package/src/generated/{types → oft302/types}/peerConfigParam.ts +0 -0
- /package/src/generated/{types → oft302/types}/version.ts +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun kinobi to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/kinobi-so/kinobi
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Serializer, struct, u64 } from '@metaplex-foundation/umi/serializers';
|
|
10
|
+
|
|
11
|
+
export type MessagingFee = { nativeFee: bigint; lzTokenFee: bigint };
|
|
12
|
+
|
|
13
|
+
export type MessagingFeeArgs = {
|
|
14
|
+
nativeFee: number | bigint;
|
|
15
|
+
lzTokenFee: number | bigint;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function getMessagingFeeSerializer(): Serializer<
|
|
19
|
+
MessagingFeeArgs,
|
|
20
|
+
MessagingFee
|
|
21
|
+
> {
|
|
22
|
+
return struct<MessagingFee>(
|
|
23
|
+
[
|
|
24
|
+
['nativeFee', u64()],
|
|
25
|
+
['lzTokenFee', u64()],
|
|
26
|
+
],
|
|
27
|
+
{ description: 'MessagingFee' }
|
|
28
|
+
) as Serializer<MessagingFeeArgs, MessagingFee>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun kinobi to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/kinobi-so/kinobi
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
Serializer,
|
|
11
|
+
string,
|
|
12
|
+
struct,
|
|
13
|
+
u64,
|
|
14
|
+
} from '@metaplex-foundation/umi/serializers';
|
|
15
|
+
|
|
16
|
+
export type OFTFeeDetail = { feeAmountLd: bigint; description: string };
|
|
17
|
+
|
|
18
|
+
export type OFTFeeDetailArgs = {
|
|
19
|
+
feeAmountLd: number | bigint;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export function getOFTFeeDetailSerializer(): Serializer<
|
|
24
|
+
OFTFeeDetailArgs,
|
|
25
|
+
OFTFeeDetail
|
|
26
|
+
> {
|
|
27
|
+
return struct<OFTFeeDetail>(
|
|
28
|
+
[
|
|
29
|
+
['feeAmountLd', u64()],
|
|
30
|
+
['description', string()],
|
|
31
|
+
],
|
|
32
|
+
{ description: 'OFTFeeDetail' }
|
|
33
|
+
) as Serializer<OFTFeeDetailArgs, OFTFeeDetail>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun kinobi to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/kinobi-so/kinobi
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Serializer, struct, u64 } from '@metaplex-foundation/umi/serializers';
|
|
10
|
+
|
|
11
|
+
export type OFTLimits = { minAmountLd: bigint; maxAmountLd: bigint };
|
|
12
|
+
|
|
13
|
+
export type OFTLimitsArgs = {
|
|
14
|
+
minAmountLd: number | bigint;
|
|
15
|
+
maxAmountLd: number | bigint;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function getOFTLimitsSerializer(): Serializer<OFTLimitsArgs, OFTLimits> {
|
|
19
|
+
return struct<OFTLimits>(
|
|
20
|
+
[
|
|
21
|
+
['minAmountLd', u64()],
|
|
22
|
+
['maxAmountLd', u64()],
|
|
23
|
+
],
|
|
24
|
+
{ description: 'OFTLimits' }
|
|
25
|
+
) as Serializer<OFTLimitsArgs, OFTLimits>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun kinobi to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/kinobi-so/kinobi
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Serializer, struct, u64 } from '@metaplex-foundation/umi/serializers';
|
|
10
|
+
|
|
11
|
+
export type OFTReceipt = { amountSentLd: bigint; amountReceivedLd: bigint };
|
|
12
|
+
|
|
13
|
+
export type OFTReceiptArgs = {
|
|
14
|
+
amountSentLd: number | bigint;
|
|
15
|
+
amountReceivedLd: number | bigint;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function getOFTReceiptSerializer(): Serializer<
|
|
19
|
+
OFTReceiptArgs,
|
|
20
|
+
OFTReceipt
|
|
21
|
+
> {
|
|
22
|
+
return struct<OFTReceipt>(
|
|
23
|
+
[
|
|
24
|
+
['amountSentLd', u64()],
|
|
25
|
+
['amountReceivedLd', u64()],
|
|
26
|
+
],
|
|
27
|
+
{ description: 'OFTReceipt' }
|
|
28
|
+
) as Serializer<OFTReceiptArgs, OFTReceipt>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun kinobi to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/kinobi-so/kinobi
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Serializer, scalarEnum } from '@metaplex-foundation/umi/serializers';
|
|
10
|
+
|
|
11
|
+
export enum OFTType {
|
|
12
|
+
Native,
|
|
13
|
+
Adapter,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type OFTTypeArgs = OFTType;
|
|
17
|
+
|
|
18
|
+
export function getOFTTypeSerializer(): Serializer<OFTTypeArgs, OFTType> {
|
|
19
|
+
return scalarEnum<OFTType>(OFTType, { description: 'OFTType' }) as Serializer<
|
|
20
|
+
OFTTypeArgs,
|
|
21
|
+
OFTType
|
|
22
|
+
>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun kinobi to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/kinobi-so/kinobi
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
Serializer,
|
|
11
|
+
array,
|
|
12
|
+
struct,
|
|
13
|
+
} from '@metaplex-foundation/umi/serializers';
|
|
14
|
+
import {
|
|
15
|
+
OFTFeeDetail,
|
|
16
|
+
OFTFeeDetailArgs,
|
|
17
|
+
OFTLimits,
|
|
18
|
+
OFTLimitsArgs,
|
|
19
|
+
OFTReceipt,
|
|
20
|
+
OFTReceiptArgs,
|
|
21
|
+
getOFTFeeDetailSerializer,
|
|
22
|
+
getOFTLimitsSerializer,
|
|
23
|
+
getOFTReceiptSerializer,
|
|
24
|
+
} from '.';
|
|
25
|
+
|
|
26
|
+
export type QuoteOFTResult = {
|
|
27
|
+
oftLimits: OFTLimits;
|
|
28
|
+
oftFeeDetails: Array<OFTFeeDetail>;
|
|
29
|
+
oftReceipt: OFTReceipt;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type QuoteOFTResultArgs = {
|
|
33
|
+
oftLimits: OFTLimitsArgs;
|
|
34
|
+
oftFeeDetails: Array<OFTFeeDetailArgs>;
|
|
35
|
+
oftReceipt: OFTReceiptArgs;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export function getQuoteOFTResultSerializer(): Serializer<
|
|
39
|
+
QuoteOFTResultArgs,
|
|
40
|
+
QuoteOFTResult
|
|
41
|
+
> {
|
|
42
|
+
return struct<QuoteOFTResult>(
|
|
43
|
+
[
|
|
44
|
+
['oftLimits', getOFTLimitsSerializer()],
|
|
45
|
+
['oftFeeDetails', array(getOFTFeeDetailSerializer())],
|
|
46
|
+
['oftReceipt', getOFTReceiptSerializer()],
|
|
47
|
+
],
|
|
48
|
+
{ description: 'QuoteOFTResult' }
|
|
49
|
+
) as Serializer<QuoteOFTResultArgs, QuoteOFTResult>;
|
|
50
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun kinobi to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/kinobi-so/kinobi
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Option, OptionOrNullable } from '@metaplex-foundation/umi';
|
|
10
|
+
import {
|
|
11
|
+
Serializer,
|
|
12
|
+
option,
|
|
13
|
+
struct,
|
|
14
|
+
u64,
|
|
15
|
+
} from '@metaplex-foundation/umi/serializers';
|
|
16
|
+
|
|
17
|
+
export type RateLimitParams = {
|
|
18
|
+
refillPerSecond: Option<bigint>;
|
|
19
|
+
capacity: Option<bigint>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type RateLimitParamsArgs = {
|
|
23
|
+
refillPerSecond: OptionOrNullable<number | bigint>;
|
|
24
|
+
capacity: OptionOrNullable<number | bigint>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export function getRateLimitParamsSerializer(): Serializer<
|
|
28
|
+
RateLimitParamsArgs,
|
|
29
|
+
RateLimitParams
|
|
30
|
+
> {
|
|
31
|
+
return struct<RateLimitParams>(
|
|
32
|
+
[
|
|
33
|
+
['refillPerSecond', option(u64())],
|
|
34
|
+
['capacity', option(u64())],
|
|
35
|
+
],
|
|
36
|
+
{ description: 'RateLimitParams' }
|
|
37
|
+
) as Serializer<RateLimitParamsArgs, RateLimitParams>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun kinobi to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/kinobi-so/kinobi
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Serializer, struct, u64 } from '@metaplex-foundation/umi/serializers';
|
|
10
|
+
|
|
11
|
+
export type RateLimiter = {
|
|
12
|
+
capacity: bigint;
|
|
13
|
+
tokens: bigint;
|
|
14
|
+
refillPerSecond: bigint;
|
|
15
|
+
lastRefillTime: bigint;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type RateLimiterArgs = {
|
|
19
|
+
capacity: number | bigint;
|
|
20
|
+
tokens: number | bigint;
|
|
21
|
+
refillPerSecond: number | bigint;
|
|
22
|
+
lastRefillTime: number | bigint;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export function getRateLimiterSerializer(): Serializer<
|
|
26
|
+
RateLimiterArgs,
|
|
27
|
+
RateLimiter
|
|
28
|
+
> {
|
|
29
|
+
return struct<RateLimiter>(
|
|
30
|
+
[
|
|
31
|
+
['capacity', u64()],
|
|
32
|
+
['tokens', u64()],
|
|
33
|
+
['refillPerSecond', u64()],
|
|
34
|
+
['lastRefillTime', u64()],
|
|
35
|
+
],
|
|
36
|
+
{ description: 'RateLimiter' }
|
|
37
|
+
) as Serializer<RateLimiterArgs, RateLimiter>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was AUTOGENERATED using the kinobi library.
|
|
3
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
4
|
+
* to add features, then rerun kinobi to update it.
|
|
5
|
+
*
|
|
6
|
+
* @see https://github.com/kinobi-so/kinobi
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { Option, OptionOrNullable, PublicKey } from '@metaplex-foundation/umi';
|
|
10
|
+
import {
|
|
11
|
+
GetDataEnumKind,
|
|
12
|
+
GetDataEnumKindContent,
|
|
13
|
+
Serializer,
|
|
14
|
+
bool,
|
|
15
|
+
dataEnum,
|
|
16
|
+
option,
|
|
17
|
+
publicKey as publicKeySerializer,
|
|
18
|
+
struct,
|
|
19
|
+
tuple,
|
|
20
|
+
u16,
|
|
21
|
+
} from '@metaplex-foundation/umi/serializers';
|
|
22
|
+
|
|
23
|
+
export type SetOFTConfigParams =
|
|
24
|
+
| { __kind: 'Admin'; fields: [PublicKey] }
|
|
25
|
+
| { __kind: 'Delegate'; fields: [PublicKey] }
|
|
26
|
+
| { __kind: 'DefaultFee'; fields: [number] }
|
|
27
|
+
| { __kind: 'Paused'; fields: [boolean] }
|
|
28
|
+
| { __kind: 'Pauser'; fields: [Option<PublicKey>] }
|
|
29
|
+
| { __kind: 'Unpauser'; fields: [Option<PublicKey>] };
|
|
30
|
+
|
|
31
|
+
export type SetOFTConfigParamsArgs =
|
|
32
|
+
| { __kind: 'Admin'; fields: [PublicKey] }
|
|
33
|
+
| { __kind: 'Delegate'; fields: [PublicKey] }
|
|
34
|
+
| { __kind: 'DefaultFee'; fields: [number] }
|
|
35
|
+
| { __kind: 'Paused'; fields: [boolean] }
|
|
36
|
+
| { __kind: 'Pauser'; fields: [OptionOrNullable<PublicKey>] }
|
|
37
|
+
| { __kind: 'Unpauser'; fields: [OptionOrNullable<PublicKey>] };
|
|
38
|
+
|
|
39
|
+
export function getSetOFTConfigParamsSerializer(): Serializer<
|
|
40
|
+
SetOFTConfigParamsArgs,
|
|
41
|
+
SetOFTConfigParams
|
|
42
|
+
> {
|
|
43
|
+
return dataEnum<SetOFTConfigParams>(
|
|
44
|
+
[
|
|
45
|
+
[
|
|
46
|
+
'Admin',
|
|
47
|
+
struct<GetDataEnumKindContent<SetOFTConfigParams, 'Admin'>>([
|
|
48
|
+
['fields', tuple([publicKeySerializer()])],
|
|
49
|
+
]),
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
'Delegate',
|
|
53
|
+
struct<GetDataEnumKindContent<SetOFTConfigParams, 'Delegate'>>([
|
|
54
|
+
['fields', tuple([publicKeySerializer()])],
|
|
55
|
+
]),
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
'DefaultFee',
|
|
59
|
+
struct<GetDataEnumKindContent<SetOFTConfigParams, 'DefaultFee'>>([
|
|
60
|
+
['fields', tuple([u16()])],
|
|
61
|
+
]),
|
|
62
|
+
],
|
|
63
|
+
[
|
|
64
|
+
'Paused',
|
|
65
|
+
struct<GetDataEnumKindContent<SetOFTConfigParams, 'Paused'>>([
|
|
66
|
+
['fields', tuple([bool()])],
|
|
67
|
+
]),
|
|
68
|
+
],
|
|
69
|
+
[
|
|
70
|
+
'Pauser',
|
|
71
|
+
struct<GetDataEnumKindContent<SetOFTConfigParams, 'Pauser'>>([
|
|
72
|
+
['fields', tuple([option(publicKeySerializer())])],
|
|
73
|
+
]),
|
|
74
|
+
],
|
|
75
|
+
[
|
|
76
|
+
'Unpauser',
|
|
77
|
+
struct<GetDataEnumKindContent<SetOFTConfigParams, 'Unpauser'>>([
|
|
78
|
+
['fields', tuple([option(publicKeySerializer())])],
|
|
79
|
+
]),
|
|
80
|
+
],
|
|
81
|
+
],
|
|
82
|
+
{ description: 'SetOFTConfigParams' }
|
|
83
|
+
) as Serializer<SetOFTConfigParamsArgs, SetOFTConfigParams>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Data Enum Helpers.
|
|
87
|
+
export function setOFTConfigParams(
|
|
88
|
+
kind: 'Admin',
|
|
89
|
+
data: GetDataEnumKindContent<SetOFTConfigParamsArgs, 'Admin'>['fields']
|
|
90
|
+
): GetDataEnumKind<SetOFTConfigParamsArgs, 'Admin'>;
|
|
91
|
+
export function setOFTConfigParams(
|
|
92
|
+
kind: 'Delegate',
|
|
93
|
+
data: GetDataEnumKindContent<SetOFTConfigParamsArgs, 'Delegate'>['fields']
|
|
94
|
+
): GetDataEnumKind<SetOFTConfigParamsArgs, 'Delegate'>;
|
|
95
|
+
export function setOFTConfigParams(
|
|
96
|
+
kind: 'DefaultFee',
|
|
97
|
+
data: GetDataEnumKindContent<SetOFTConfigParamsArgs, 'DefaultFee'>['fields']
|
|
98
|
+
): GetDataEnumKind<SetOFTConfigParamsArgs, 'DefaultFee'>;
|
|
99
|
+
export function setOFTConfigParams(
|
|
100
|
+
kind: 'Paused',
|
|
101
|
+
data: GetDataEnumKindContent<SetOFTConfigParamsArgs, 'Paused'>['fields']
|
|
102
|
+
): GetDataEnumKind<SetOFTConfigParamsArgs, 'Paused'>;
|
|
103
|
+
export function setOFTConfigParams(
|
|
104
|
+
kind: 'Pauser',
|
|
105
|
+
data: GetDataEnumKindContent<SetOFTConfigParamsArgs, 'Pauser'>['fields']
|
|
106
|
+
): GetDataEnumKind<SetOFTConfigParamsArgs, 'Pauser'>;
|
|
107
|
+
export function setOFTConfigParams(
|
|
108
|
+
kind: 'Unpauser',
|
|
109
|
+
data: GetDataEnumKindContent<SetOFTConfigParamsArgs, 'Unpauser'>['fields']
|
|
110
|
+
): GetDataEnumKind<SetOFTConfigParamsArgs, 'Unpauser'>;
|
|
111
|
+
export function setOFTConfigParams<K extends SetOFTConfigParamsArgs['__kind']>(
|
|
112
|
+
kind: K,
|
|
113
|
+
data?: any
|
|
114
|
+
): Extract<SetOFTConfigParamsArgs, { __kind: K }> {
|
|
115
|
+
return Array.isArray(data)
|
|
116
|
+
? { __kind: kind, fields: data }
|
|
117
|
+
: { __kind: kind, ...(data ?? {}) };
|
|
118
|
+
}
|
|
119
|
+
export function isSetOFTConfigParams<K extends SetOFTConfigParams['__kind']>(
|
|
120
|
+
kind: K,
|
|
121
|
+
value: SetOFTConfigParams
|
|
122
|
+
): value is SetOFTConfigParams & { __kind: K } {
|
|
123
|
+
return value.__kind === kind;
|
|
124
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,46 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export * as accounts from './generated/accounts'
|
|
8
|
-
export * as instructions from './generated/instructions'
|
|
9
|
-
export * as programs from './generated/programs'
|
|
10
|
-
export * as shared from './generated/shared'
|
|
11
|
-
export * as types from './generated/types'
|
|
12
|
-
export * as errors from './generated/errors'
|
|
13
|
-
export * as oft from './oft'
|
|
14
|
-
|
|
15
|
-
export const OFT_DECIMALS = 6
|
|
16
|
-
|
|
17
|
-
export const OFT_SEED = 'OFT'
|
|
18
|
-
|
|
19
|
-
export const PEER_SEED = 'Peer'
|
|
20
|
-
|
|
21
|
-
const eddsa = createWeb3JsEddsa()
|
|
22
|
-
|
|
23
|
-
export class OftPDA {
|
|
24
|
-
constructor(public readonly program: PublicKey) {}
|
|
25
|
-
|
|
26
|
-
config(): [PublicKey, number] {
|
|
27
|
-
return eddsa.findPda(this.program, [Buffer.from('OftConfig', 'utf8')])
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
peer(oftStore: PublicKey, eid: number): [PublicKey, number] {
|
|
31
|
-
return eddsa.findPda(this.program, [
|
|
32
|
-
Buffer.from(PEER_SEED, 'utf8'),
|
|
33
|
-
publicKeyBytes(oftStore),
|
|
34
|
-
u32({ endian: Endian.Big }).serialize(eid),
|
|
35
|
-
// new BN(eid).toArrayLike(Buffer, 'be', 4),
|
|
36
|
-
])
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
oftStore(escrow: PublicKey): [PublicKey, number] {
|
|
40
|
-
return eddsa.findPda(this.program, [Buffer.from(OFT_SEED, 'utf8'), publicKeyBytes(escrow)])
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
lzReceiveTypesAccounts(oftConfig: PublicKey): [PublicKey, number] {
|
|
44
|
-
return eddsa.findPda(this.program, [Buffer.from(LZ_RECEIVE_TYPES_SEED, 'utf8'), publicKeyBytes(oftConfig)])
|
|
45
|
-
}
|
|
46
|
-
}
|
|
1
|
+
export * as oft from './oft302'
|
|
2
|
+
export * as oft302 from './oft302'
|
|
3
|
+
export * as oft202 from './oft202'
|
|
4
|
+
export * from './pda'
|
|
5
|
+
export * from './consts'
|