@bsv/sdk
Version:
BSV Blockchain Software Development Kit
44 lines • 1.92 kB
TypeScript
import PushDrop from '../script/templates/PushDrop.js';
import { WalletInterface } from '../wallet/Wallet.interfaces.js';
import { LockingScript, ScriptTemplate, UnlockingScript } from '../script/index.js';
import { Transaction } from '../transaction/index.js';
/**
* Script template enabling the creation, unlocking, and decoding of SHIP and SLAP advertisements.
*/
export default class OverlayAdminTokenTemplate implements ScriptTemplate {
pushDrop: PushDrop;
/**
* Decodes a SHIP or SLAP advertisement from a given locking script.
* @param script Locking script comprising a SHIP or SLAP token to decode
* @returns Decoded SHIP or SLAP advertisement
*/
static decode(script: LockingScript): {
protocol: 'SHIP' | 'SLAP';
identityKey: string;
domain: string;
topicOrService: string;
};
/**
* Constructs a new Overlay Admin template instance
* @param wallet Wallet to use for locking and unlocking
*/
constructor(wallet: WalletInterface);
/**
* Creates a new advertisement locking script
* @param protocol SHIP or SLAP
* @param domain Domain where the topic or service is available
* @param topicOrService Topic or service to advertise
* @returns Locking script comprising the advertisement token
*/
lock(protocol: 'SHIP' | 'SLAP', domain: string, topicOrService: string): Promise<LockingScript>;
/**
* Unlocks an advertisement token as part of a transaction.
* @param protocol SHIP or SLAP, depending on the token to unlock
* @returns Script unlocker capable of unlocking the advertisement token
*/
unlock(protocol: 'SHIP' | 'SLAP'): {
sign: (tx: Transaction, inputIndex: number) => Promise<UnlockingScript>;
estimateLength: (tx: Transaction, inputIndex: number) => Promise<number>;
};
}
//# sourceMappingURL=OverlayAdminTokenTemplate.d.ts.map