Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/alkanes/alkanes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export declare const executePsbt: ({ alkanesUtxos, utxos, account, protostone, p
psbt: string;
fee: number;
}>;
export declare const executeFallbackToWitnessProxy: ({ alkanesUtxos, utxos, account, calldata, provider, feeRate, signer, frontendFee, feeAddress, witnessProxy, frbtcWrapAmount, }: {
export declare const executeFallbackToWitnessProxy: ({ alkanesUtxos, utxos, account, calldata, provider, feeRate, signer, frontendFee, feeAddress, witnessProxy, frbtcWrapAmount, addDieselMint, }: {
alkanesUtxos?: FormattedUtxo[];
utxos: FormattedUtxo[];
account: Account;
Expand All @@ -210,6 +210,7 @@ export declare const executeFallbackToWitnessProxy: ({ alkanesUtxos, utxos, acco
feeAddress?: string;
witnessProxy?: AlkaneId;
frbtcWrapAmount?: number;
addDieselMint?: boolean;
}) => Promise<{
txId: string;
rawTx: string;
Expand Down Expand Up @@ -249,13 +250,14 @@ export declare const actualWrapBtcFee: ({ alkanesUtxos, utxos, account, protosto
fee: number;
vsize: number;
}>;
export declare const wrapBtcNoSigning: ({ alkanesUtxos, utxos, account, provider, feeRate, wrapAmount, }: {
export declare const wrapBtcNoSigning: ({ alkanesUtxos, utxos, account, provider, feeRate, wrapAmount, addDieselMint, }: {
alkanesUtxos?: FormattedUtxo[];
utxos: FormattedUtxo[];
account: Account;
provider: Provider;
feeRate?: number;
wrapAmount: number;
addDieselMint?: boolean;
}) => Promise<{
psbt: string;
psbtHex: string;
Expand Down
9 changes: 7 additions & 2 deletions lib/alkanes/alkanes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/alkanes/alkanes.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/alkanes/token.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/alkanes/token.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions lib/shared/constants.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { ProtoStone } from 'alkanes/lib/index';
import { MnemonicToAccountOptions } from '..';
export declare const UTXO_DUST = 546;
export declare const maximumScriptBytes = 520;
export declare const MAXIMUM_FEE = 5000000;
export declare const DIESEL_MINT_PROTOSTONE: ProtoStone;
export declare const regtestOpts: MnemonicToAccountOptions;
export declare const Opts: MnemonicToAccountOptions;
export declare const regtestMnemonic: string;
Expand Down
10 changes: 9 additions & 1 deletion lib/shared/constants.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/shared/constants.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion src/alkanes/alkanes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ProtoruneEdict } from 'alkanes/lib/protorune/protoruneedict'
import { ProtoruneRuneId } from 'alkanes/lib/protorune/protoruneruneid'
import { u128, u32 } from '@magiceden-oss/runestone-lib/dist/src/integer'
import { getWrapAddress } from '../amm/subfrost'
import { Account, AlkaneId, Signer } from '..'
import { Account, AlkaneId, DIESEL_MINT_PROTOSTONE, Signer } from '..'
import {
addInputUtxosToPsbt,
findXAmountOfSats,
Expand Down Expand Up @@ -1189,6 +1189,7 @@ export const executeFallbackToWitnessProxy = async ({
feeAddress,
witnessProxy,
frbtcWrapAmount,
addDieselMint,
}: {
alkanesUtxos?: FormattedUtxo[]
utxos: FormattedUtxo[]
Expand All @@ -1201,6 +1202,7 @@ export const executeFallbackToWitnessProxy = async ({
feeAddress?: string
witnessProxy?: AlkaneId
frbtcWrapAmount?: number
addDieselMint?: boolean
}) => {
let frbtcWrapPsbt;
let remainingUtxos = utxos;
Expand All @@ -1213,6 +1215,7 @@ export const executeFallbackToWitnessProxy = async ({
provider,
feeRate,
wrapAmount: frbtcWrapAmount,
addDieselMint,
})
frbtcWrapPsbt = bitcoin.Psbt.fromBase64(psbt, {
network: provider.network,
Expand Down Expand Up @@ -1241,6 +1244,7 @@ export const executeFallbackToWitnessProxy = async ({
refundPointer: 0,
calldata: encipher(calldata),
}),
...(addDieselMint ? [DIESEL_MINT_PROTOSTONE] : [])
],
}).encodedRunestone;
if (protostone.length > 80) {
Expand All @@ -1262,6 +1266,7 @@ export const executeFallbackToWitnessProxy = async ({
refundPointer: 0,
calldata: encipher(proxy_calldata),
}),
...(addDieselMint ? [DIESEL_MINT_PROTOSTONE] : [])
],
}).encodedRunestone;
const payload: AlkanesPayload = {
Expand Down Expand Up @@ -1433,13 +1438,15 @@ export const wrapBtcNoSigning = async ({
provider,
feeRate,
wrapAmount,
addDieselMint,
}: {
alkanesUtxos?: FormattedUtxo[]
utxos: FormattedUtxo[]
account: Account
provider: Provider
feeRate?: number
wrapAmount: number
addDieselMint?: boolean
}) => {
const calldata: bigint[] = [32n, 0n, 77n]

Expand All @@ -1452,6 +1459,7 @@ export const wrapBtcNoSigning = async ({
refundPointer: 0,
calldata: encipher(calldata),
}),
...(addDieselMint ? [DIESEL_MINT_PROTOSTONE] : [])
],
}).encodedRunestone
const { fee } = await actualWrapBtcFee({
Expand Down
4 changes: 2 additions & 2 deletions src/alkanes/token.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { minimumFee } from '../btc'
import { u128, u32 } from '@magiceden-oss/runestone-lib/dist/src/integer'
import { Account, Signer, Provider, AlkanesPayload } from '..'
import { ProtoStone, encodeRunestoneProtostone } from 'alkanes/lib/index.js'
import { ProtoStone, encipher, encodeRunestoneProtostone } from 'alkanes/lib/index.js'
import { ProtoruneRuneId } from 'alkanes/lib/protorune/protoruneruneid'
import { OylTransactionError } from '../errors'
import { AlkaneId } from '@alkanes/types'
Expand Down Expand Up @@ -178,7 +178,7 @@ export const createSendPsbt = async ({
],
pointer: 0,
refundPointer: 0,
calldata: Buffer.from([]),
calldata: encipher([BigInt(2), BigInt(0), BigInt(77)]),
}),
],
}).encodedRunestone
Expand Down
11 changes: 11 additions & 0 deletions src/shared/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import {
encipher,
ProtoStone,
} from 'alkanes/lib/index'
import { MnemonicToAccountOptions } from '..'
import * as bitcoin from 'bitcoinjs-lib'
import * as dotenv from 'dotenv'
Expand All @@ -9,6 +13,13 @@ export const maximumScriptBytes = 520

export const MAXIMUM_FEE = 5000000

export const DIESEL_MINT_PROTOSTONE = ProtoStone.message({
protocolTag: 1n,
edicts: [],
pointer: 0,
refundPointer: 0,
calldata: encipher([BigInt(2), BigInt(0), BigInt(77)]),
});

export const regtestOpts: MnemonicToAccountOptions = {
network: bitcoin.networks.regtest,
Expand Down