@m0-foundation/ntt-sdk-route 0.0.11 → 0.0.13
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/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +23 -9
- package/dist/index.mjs +23 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ import { EvmChains, EvmUnsignedTransaction } from '@wormhole-foundation/sdk-evm'
|
|
|
6
6
|
import { SolanaChains, SolanaUnsignedTransaction } from '@wormhole-foundation/sdk-solana';
|
|
7
7
|
import { NttRoute } from '@wormhole-foundation/sdk-route-ntt';
|
|
8
8
|
import { TransactionRequest } from 'ethers';
|
|
9
|
-
import { PublicKey, TransactionInstruction, Connection, AddressLookupTableAccount } from '@solana/web3.js';
|
|
9
|
+
import { Keypair, PublicKey, TransactionInstruction, Connection, AddressLookupTableAccount } from '@solana/web3.js';
|
|
10
10
|
|
|
11
11
|
type Op = NttRoute.Options;
|
|
12
12
|
type Tp = routes.TransferParams<Op>;
|
|
@@ -44,7 +44,7 @@ declare class M0AutomaticRoute<N extends Network> extends routes.AutomaticRoute<
|
|
|
44
44
|
*/
|
|
45
45
|
transferMLike<N extends Network, C extends EvmChains>(ntt: EvmNtt<N, C>, sender: AccountAddress<C>, amount: bigint, destination: ChainAddress, sourceToken: string, destinationToken: string, options: Ntt.TransferOptions): AsyncGenerator<EvmUnsignedTransaction<N, C>>;
|
|
46
46
|
createUnsignedTx<N extends Network, C extends EvmChains>(ntt: EvmNtt<N, C>, txReq: TransactionRequest, description: string, parallelizable?: boolean): EvmUnsignedTransaction<N, C>;
|
|
47
|
-
transferSolanaExtension<N extends Network, C extends SolanaChains>(ntt: SolanaNtt<N, C>, sender: AccountAddress<C>, amount: bigint, recipient: ChainAddress, sourceToken: string, destinationToken: string, options: Ntt.TransferOptions): AsyncGenerator<SolanaUnsignedTransaction<N, C>>;
|
|
47
|
+
transferSolanaExtension<N extends Network, C extends SolanaChains>(ntt: SolanaNtt<N, C>, sender: AccountAddress<C>, amount: bigint, recipient: ChainAddress, sourceToken: string, destinationToken: string, options: Ntt.TransferOptions, outboxItem?: Keypair): AsyncGenerator<SolanaUnsignedTransaction<N, C>>;
|
|
48
48
|
track(receipt: R, timeout?: number): AsyncGenerator<R, void, unknown>;
|
|
49
49
|
}
|
|
50
50
|
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { EvmChains, EvmUnsignedTransaction } from '@wormhole-foundation/sdk-evm'
|
|
|
6
6
|
import { SolanaChains, SolanaUnsignedTransaction } from '@wormhole-foundation/sdk-solana';
|
|
7
7
|
import { NttRoute } from '@wormhole-foundation/sdk-route-ntt';
|
|
8
8
|
import { TransactionRequest } from 'ethers';
|
|
9
|
-
import { PublicKey, TransactionInstruction, Connection, AddressLookupTableAccount } from '@solana/web3.js';
|
|
9
|
+
import { Keypair, PublicKey, TransactionInstruction, Connection, AddressLookupTableAccount } from '@solana/web3.js';
|
|
10
10
|
|
|
11
11
|
type Op = NttRoute.Options;
|
|
12
12
|
type Tp = routes.TransferParams<Op>;
|
|
@@ -44,7 +44,7 @@ declare class M0AutomaticRoute<N extends Network> extends routes.AutomaticRoute<
|
|
|
44
44
|
*/
|
|
45
45
|
transferMLike<N extends Network, C extends EvmChains>(ntt: EvmNtt<N, C>, sender: AccountAddress<C>, amount: bigint, destination: ChainAddress, sourceToken: string, destinationToken: string, options: Ntt.TransferOptions): AsyncGenerator<EvmUnsignedTransaction<N, C>>;
|
|
46
46
|
createUnsignedTx<N extends Network, C extends EvmChains>(ntt: EvmNtt<N, C>, txReq: TransactionRequest, description: string, parallelizable?: boolean): EvmUnsignedTransaction<N, C>;
|
|
47
|
-
transferSolanaExtension<N extends Network, C extends SolanaChains>(ntt: SolanaNtt<N, C>, sender: AccountAddress<C>, amount: bigint, recipient: ChainAddress, sourceToken: string, destinationToken: string, options: Ntt.TransferOptions): AsyncGenerator<SolanaUnsignedTransaction<N, C>>;
|
|
47
|
+
transferSolanaExtension<N extends Network, C extends SolanaChains>(ntt: SolanaNtt<N, C>, sender: AccountAddress<C>, amount: bigint, recipient: ChainAddress, sourceToken: string, destinationToken: string, options: Ntt.TransferOptions, outboxItem?: Keypair): AsyncGenerator<SolanaUnsignedTransaction<N, C>>;
|
|
48
48
|
track(receipt: R, timeout?: number): AsyncGenerator<R, void, unknown>;
|
|
49
49
|
}
|
|
50
50
|
|
package/dist/index.js
CHANGED
|
@@ -514,13 +514,27 @@ var SolanaRoutes = class _SolanaRoutes {
|
|
|
514
514
|
additionalPayload.slice(8, 40)
|
|
515
515
|
);
|
|
516
516
|
if (destinationMint.equals(ntt.config.mint)) {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
517
|
+
const ix = await sdkSolanaNtt.NTT.createReleaseInboundMintInstruction(
|
|
518
|
+
ntt.program,
|
|
519
|
+
ntt.config,
|
|
520
|
+
args
|
|
521
|
+
);
|
|
522
|
+
ix.keys.push(
|
|
523
|
+
{
|
|
524
|
+
pubkey: router.programs.earn,
|
|
525
|
+
isSigner: false,
|
|
526
|
+
isWritable: false
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
pubkey: web3_js.PublicKey.findProgramAddressSync(
|
|
530
|
+
[Buffer.from("global")],
|
|
531
|
+
router.programs.earn
|
|
532
|
+
)[0],
|
|
533
|
+
isSigner: false,
|
|
534
|
+
isWritable: true
|
|
535
|
+
}
|
|
536
|
+
);
|
|
537
|
+
return [ix];
|
|
524
538
|
}
|
|
525
539
|
const extPrograms = router.extPrograms[destinationMint.toBase58()];
|
|
526
540
|
if (!extPrograms) {
|
|
@@ -810,14 +824,14 @@ var _M0AutomaticRoute = class _M0AutomaticRoute extends sdkConnect.routes.Automa
|
|
|
810
824
|
parallelizable
|
|
811
825
|
);
|
|
812
826
|
}
|
|
813
|
-
async *transferSolanaExtension(ntt, sender, amount2, recipient, sourceToken, destinationToken, options) {
|
|
827
|
+
async *transferSolanaExtension(ntt, sender, amount2, recipient, sourceToken, destinationToken, options, outboxItem) {
|
|
814
828
|
const router = new SolanaRoutes(ntt);
|
|
815
829
|
if ((await ntt.getConfig()).mint.toBase58() === sourceToken) {
|
|
816
830
|
return ntt.transfer(sender, amount2, recipient, options);
|
|
817
831
|
}
|
|
818
832
|
const config = await ntt.getConfig();
|
|
819
833
|
if (config.paused) throw new Error("Contract is paused");
|
|
820
|
-
|
|
834
|
+
outboxItem = outboxItem ?? web3_js.Keypair.generate();
|
|
821
835
|
const payerAddress = new sdkSolana.SolanaAddress(sender).unwrap();
|
|
822
836
|
const ixs = [
|
|
823
837
|
router.getTransferExtensionBurnIx(
|
package/dist/index.mjs
CHANGED
|
@@ -508,13 +508,27 @@ var SolanaRoutes = class _SolanaRoutes {
|
|
|
508
508
|
additionalPayload.slice(8, 40)
|
|
509
509
|
);
|
|
510
510
|
if (destinationMint.equals(ntt.config.mint)) {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
511
|
+
const ix = await NTT.createReleaseInboundMintInstruction(
|
|
512
|
+
ntt.program,
|
|
513
|
+
ntt.config,
|
|
514
|
+
args
|
|
515
|
+
);
|
|
516
|
+
ix.keys.push(
|
|
517
|
+
{
|
|
518
|
+
pubkey: router.programs.earn,
|
|
519
|
+
isSigner: false,
|
|
520
|
+
isWritable: false
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
pubkey: PublicKey.findProgramAddressSync(
|
|
524
|
+
[Buffer.from("global")],
|
|
525
|
+
router.programs.earn
|
|
526
|
+
)[0],
|
|
527
|
+
isSigner: false,
|
|
528
|
+
isWritable: true
|
|
529
|
+
}
|
|
530
|
+
);
|
|
531
|
+
return [ix];
|
|
518
532
|
}
|
|
519
533
|
const extPrograms = router.extPrograms[destinationMint.toBase58()];
|
|
520
534
|
if (!extPrograms) {
|
|
@@ -804,14 +818,14 @@ var _M0AutomaticRoute = class _M0AutomaticRoute extends routes.AutomaticRoute {
|
|
|
804
818
|
parallelizable
|
|
805
819
|
);
|
|
806
820
|
}
|
|
807
|
-
async *transferSolanaExtension(ntt, sender, amount2, recipient, sourceToken, destinationToken, options) {
|
|
821
|
+
async *transferSolanaExtension(ntt, sender, amount2, recipient, sourceToken, destinationToken, options, outboxItem) {
|
|
808
822
|
const router = new SolanaRoutes(ntt);
|
|
809
823
|
if ((await ntt.getConfig()).mint.toBase58() === sourceToken) {
|
|
810
824
|
return ntt.transfer(sender, amount2, recipient, options);
|
|
811
825
|
}
|
|
812
826
|
const config = await ntt.getConfig();
|
|
813
827
|
if (config.paused) throw new Error("Contract is paused");
|
|
814
|
-
|
|
828
|
+
outboxItem = outboxItem ?? Keypair.generate();
|
|
815
829
|
const payerAddress = new SolanaAddress(sender).unwrap();
|
|
816
830
|
const ixs = [
|
|
817
831
|
router.getTransferExtensionBurnIx(
|