First commit
This commit is contained in:
		
							
								
								
									
										8
									
								
								wallet/address-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								wallet/address-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| import { ApiAddress, ApiAddressStateEnum } from '../models'; | ||||
| export declare class AddressWallet implements ApiAddress { | ||||
|     id: string; | ||||
|     state: ApiAddressStateEnum; | ||||
|     constructor(address: string, state?: ApiAddressStateEnum); | ||||
|     get address(): string; | ||||
|     used(): boolean; | ||||
| } | ||||
							
								
								
									
										24
									
								
								wallet/address-wallet.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								wallet/address-wallet.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.AddressWallet = void 0; | ||||
| var models_1 = require("../models"); | ||||
| var AddressWallet = /** @class */ (function () { | ||||
|     function AddressWallet(address, state) { | ||||
|         if (state === void 0) { state = models_1.ApiAddressStateEnum.Unused; } | ||||
|         this.id = address; | ||||
|         this.state = state; | ||||
|     } | ||||
|     Object.defineProperty(AddressWallet.prototype, "address", { | ||||
|         get: function () { | ||||
|             return this.id; | ||||
|         }, | ||||
|         enumerable: false, | ||||
|         configurable: true | ||||
|     }); | ||||
|     AddressWallet.prototype.used = function () { | ||||
|         return this.state === models_1.ApiAddressStateEnum.Used; | ||||
|     }; | ||||
|     return AddressWallet; | ||||
| }()); | ||||
| exports.AddressWallet = AddressWallet; | ||||
| //# sourceMappingURL=address-wallet.js.map | ||||
							
								
								
									
										1
									
								
								wallet/address-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								wallet/address-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| {"version":3,"file":"address-wallet.js","sourceRoot":"","sources":["../../wallet/address-wallet.ts"],"names":[],"mappings":";;;AAAA,oCAA2D;AAE3D;IAIE,uBACE,OAAe,EACf,KAAuD;QAAvD,sBAAA,EAAA,QAA6B,4BAAmB,CAAC,MAAM;QAEvD,IAAI,CAAC,EAAE,GAAG,OAAO,CAAA;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,sBAAI,kCAAO;aAAX;YACE,OAAO,IAAI,CAAC,EAAE,CAAA;QAChB,CAAC;;;OAAA;IAED,4BAAI,GAAJ;QACE,OAAO,IAAI,CAAC,KAAK,KAAK,4BAAmB,CAAC,IAAI,CAAA;IAChD,CAAC;IACH,oBAAC;AAAD,CAAC,AAnBD,IAmBC;AAnBY,sCAAa"} | ||||
							
								
								
									
										7
									
								
								wallet/asset-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								wallet/asset-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| import { WalletsAssetsAvailable } from '../models'; | ||||
| export declare class AssetWallet implements WalletsAssetsAvailable { | ||||
|     policy_id: string; | ||||
|     asset_name: string; | ||||
|     quantity: number; | ||||
|     constructor(policy_id: string, asset_name: string, quantity: number); | ||||
| } | ||||
							
								
								
									
										13
									
								
								wallet/asset-wallet.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								wallet/asset-wallet.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.AssetWallet = void 0; | ||||
| var AssetWallet = /** @class */ (function () { | ||||
|     function AssetWallet(policy_id, asset_name, quantity) { | ||||
|         this.policy_id = policy_id; | ||||
|         this.asset_name = asset_name; | ||||
|         this.quantity = quantity; | ||||
|     } | ||||
|     return AssetWallet; | ||||
| }()); | ||||
| exports.AssetWallet = AssetWallet; | ||||
| //# sourceMappingURL=asset-wallet.js.map | ||||
							
								
								
									
										1
									
								
								wallet/asset-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								wallet/asset-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| {"version":3,"file":"asset-wallet.js","sourceRoot":"","sources":["../../wallet/asset-wallet.ts"],"names":[],"mappings":";;;AAEA;IAIE,qBAAY,SAAiB,EAAE,UAAkB,EAAE,QAAgB;QACjE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IACH,kBAAC;AAAD,CAAC,AATD,IASC;AATY,kCAAW"} | ||||
							
								
								
									
										12
									
								
								wallet/coin-selection-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								wallet/coin-selection-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| import { ApiCoinSelection, ApiCoinSelectionCertificates, ApiCoinSelectionChange, ApiCoinSelectionInputs, ApiCoinSelectionWithdrawals, WalletswalletIdpaymentfeesAmount, WalletswalletIdpaymentfeesPayments } from '../models'; | ||||
| export declare class CoinSelectionWallet implements ApiCoinSelection { | ||||
|     inputs: ApiCoinSelectionInputs[]; | ||||
|     outputs: WalletswalletIdpaymentfeesPayments[]; | ||||
|     change: ApiCoinSelectionChange[]; | ||||
|     withdrawals?: ApiCoinSelectionWithdrawals[]; | ||||
|     certificates?: ApiCoinSelectionCertificates[]; | ||||
|     deposits?: WalletswalletIdpaymentfeesAmount[]; | ||||
|     metadata?: any; | ||||
|     constructor(inputs: ApiCoinSelectionInputs[], outputs: WalletswalletIdpaymentfeesPayments[], change: ApiCoinSelectionChange[], withdrawals: ApiCoinSelectionWithdrawals[], certificates: ApiCoinSelectionCertificates[], deposits: WalletswalletIdpaymentfeesAmount[], metadata: any); | ||||
|     static from(coinSelection: ApiCoinSelection): CoinSelectionWallet; | ||||
| } | ||||
							
								
								
									
										20
									
								
								wallet/coin-selection-wallet.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								wallet/coin-selection-wallet.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.CoinSelectionWallet = void 0; | ||||
| var CoinSelectionWallet = /** @class */ (function () { | ||||
|     function CoinSelectionWallet(inputs, outputs, change, withdrawals, certificates, deposits, metadata) { | ||||
|         this.inputs = inputs; | ||||
|         this.outputs = outputs; | ||||
|         this.change = change; | ||||
|         this.withdrawals = withdrawals; | ||||
|         this.certificates = certificates; | ||||
|         this.deposits = deposits; | ||||
|         this.metadata = metadata; | ||||
|     } | ||||
|     CoinSelectionWallet.from = function (coinSelection) { | ||||
|         return new this(coinSelection.inputs, coinSelection.outputs, coinSelection.change, coinSelection.withdrawals, coinSelection.certificates, coinSelection.deposits, coinSelection.metadata); | ||||
|     }; | ||||
|     return CoinSelectionWallet; | ||||
| }()); | ||||
| exports.CoinSelectionWallet = CoinSelectionWallet; | ||||
| //# sourceMappingURL=coin-selection-wallet.js.map | ||||
							
								
								
									
										1
									
								
								wallet/coin-selection-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								wallet/coin-selection-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| {"version":3,"file":"coin-selection-wallet.js","sourceRoot":"","sources":["../../wallet/coin-selection-wallet.ts"],"names":[],"mappings":";;;AAUA;IASE,6BACE,MAAgC,EAChC,OAA6C,EAC7C,MAAgC,EAChC,WAA0C,EAC1C,YAA4C,EAC5C,QAA4C,EAC5C,QAAa;QAEb,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;QAChC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAEM,wBAAI,GAAX,UAAY,aAA+B;QACzC,OAAO,IAAI,IAAI,CACb,aAAa,CAAC,MAAM,EACpB,aAAa,CAAC,OAAO,EACrB,aAAa,CAAC,MAAM,EACpB,aAAa,CAAC,WAAW,EACzB,aAAa,CAAC,YAAY,EAC1B,aAAa,CAAC,QAAQ,EACtB,aAAa,CAAC,QAAQ,CACvB,CAAA;IACH,CAAC;IACH,0BAAC;AAAD,CAAC,AAtCD,IAsCC;AAtCY,kDAAmB"} | ||||
							
								
								
									
										9
									
								
								wallet/fee-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								wallet/fee-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| import { ApiFee, WalletswalletIdpaymentfeesAmount } from '../models'; | ||||
| export declare class FeeWallet implements ApiFee { | ||||
|     estimated_min: WalletswalletIdpaymentfeesAmount; | ||||
|     estimated_max: WalletswalletIdpaymentfeesAmount; | ||||
|     minimum_coins: WalletswalletIdpaymentfeesAmount[]; | ||||
|     deposit: WalletswalletIdpaymentfeesAmount; | ||||
|     constructor(estimated_min: WalletswalletIdpaymentfeesAmount, estimated_max: WalletswalletIdpaymentfeesAmount, minimum_coins: WalletswalletIdpaymentfeesAmount[], deposit: WalletswalletIdpaymentfeesAmount); | ||||
|     static from(fee: ApiFee): FeeWallet; | ||||
| } | ||||
							
								
								
									
										17
									
								
								wallet/fee-wallet.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								wallet/fee-wallet.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.FeeWallet = void 0; | ||||
| var FeeWallet = /** @class */ (function () { | ||||
|     function FeeWallet(estimated_min, estimated_max, minimum_coins, deposit) { | ||||
|         this.estimated_min = estimated_min; | ||||
|         this.estimated_max = estimated_max; | ||||
|         this.minimum_coins = minimum_coins; | ||||
|         this.deposit = deposit; | ||||
|     } | ||||
|     FeeWallet.from = function (fee) { | ||||
|         return new this(fee.estimated_min, fee.estimated_max, fee.minimum_coins, fee.deposit); | ||||
|     }; | ||||
|     return FeeWallet; | ||||
| }()); | ||||
| exports.FeeWallet = FeeWallet; | ||||
| //# sourceMappingURL=fee-wallet.js.map | ||||
							
								
								
									
										1
									
								
								wallet/fee-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								wallet/fee-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| {"version":3,"file":"fee-wallet.js","sourceRoot":"","sources":["../../wallet/fee-wallet.ts"],"names":[],"mappings":";;;AAEA;IAME,mBACE,aAA+C,EAC/C,aAA+C,EAC/C,aAAiD,EACjD,OAAyC;QAEzC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAEM,cAAI,GAAX,UAAY,GAAW;QACrB,OAAO,IAAI,IAAI,CACb,GAAG,CAAC,aAAa,EACjB,GAAG,CAAC,aAAa,EACjB,GAAG,CAAC,aAAa,EACjB,GAAG,CAAC,OAAO,CACZ,CAAA;IACH,CAAC;IACH,gBAAC;AAAD,CAAC,AA1BD,IA0BC;AA1BY,8BAAS"} | ||||
							
								
								
									
										12
									
								
								wallet/key-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								wallet/key-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| import { ApiVerificationKey } from '../models'; | ||||
| export declare class KeyWallet implements ApiVerificationKey { | ||||
|     key: any; | ||||
|     role: KeyRoleEnum; | ||||
|     constructor(key: any, role: KeyRoleEnum); | ||||
| } | ||||
| export declare enum KeyRoleEnum { | ||||
|     AddressExternal = "utxo_external", | ||||
|     AddressInternal = "utxo_internal", | ||||
|     Stake = "mutable_account", | ||||
|     Script = "multisig_script" | ||||
| } | ||||
							
								
								
									
										19
									
								
								wallet/key-wallet.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								wallet/key-wallet.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.KeyRoleEnum = exports.KeyWallet = void 0; | ||||
| var KeyWallet = /** @class */ (function () { | ||||
|     function KeyWallet(key, role) { | ||||
|         this.key = key; | ||||
|         this.role = role; | ||||
|     } | ||||
|     return KeyWallet; | ||||
| }()); | ||||
| exports.KeyWallet = KeyWallet; | ||||
| var KeyRoleEnum; | ||||
| (function (KeyRoleEnum) { | ||||
|     KeyRoleEnum["AddressExternal"] = "utxo_external"; | ||||
|     KeyRoleEnum["AddressInternal"] = "utxo_internal"; | ||||
|     KeyRoleEnum["Stake"] = "mutable_account"; | ||||
|     KeyRoleEnum["Script"] = "multisig_script"; | ||||
| })(KeyRoleEnum = exports.KeyRoleEnum || (exports.KeyRoleEnum = {})); | ||||
| //# sourceMappingURL=key-wallet.js.map | ||||
							
								
								
									
										1
									
								
								wallet/key-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								wallet/key-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| {"version":3,"file":"key-wallet.js","sourceRoot":"","sources":["../../wallet/key-wallet.ts"],"names":[],"mappings":";;;AAEA;IAGE,mBAAY,GAAQ,EAAE,IAAiB;QACrC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IACH,gBAAC;AAAD,CAAC,AAPD,IAOC;AAPY,8BAAS;AAStB,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,gDAAiC,CAAA;IACjC,gDAAiC,CAAA;IACjC,wCAAyB,CAAA;IACzB,yCAA0B,CAAA;AAC5B,CAAC,EALW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAKtB"} | ||||
							
								
								
									
										5
									
								
								wallet/maintenance-action-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								wallet/maintenance-action-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | ||||
| import { ApiMaintenanceAction, ApiMaintenanceActionGcStakePools } from '../models'; | ||||
| export declare class MaintenanceActionWallet implements ApiMaintenanceAction { | ||||
|     gc_stake_pools: ApiMaintenanceActionGcStakePools; | ||||
|     constructor(gc_stake_pools: ApiMaintenanceActionGcStakePools); | ||||
| } | ||||
							
								
								
									
										11
									
								
								wallet/maintenance-action-wallet.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								wallet/maintenance-action-wallet.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.MaintenanceActionWallet = void 0; | ||||
| var MaintenanceActionWallet = /** @class */ (function () { | ||||
|     function MaintenanceActionWallet(gc_stake_pools) { | ||||
|         this.gc_stake_pools = gc_stake_pools; | ||||
|     } | ||||
|     return MaintenanceActionWallet; | ||||
| }()); | ||||
| exports.MaintenanceActionWallet = MaintenanceActionWallet; | ||||
| //# sourceMappingURL=maintenance-action-wallet.js.map | ||||
							
								
								
									
										1
									
								
								wallet/maintenance-action-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								wallet/maintenance-action-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| {"version":3,"file":"maintenance-action-wallet.js","sourceRoot":"","sources":["../../wallet/maintenance-action-wallet.ts"],"names":[],"mappings":";;;AAKA;IAGE,iCAAY,cAAgD;QAC1D,IAAI,CAAC,cAAc,GAAG,cAAc,CAAA;IACtC,CAAC;IACH,8BAAC;AAAD,CAAC,AAND,IAMC;AANY,0DAAuB"} | ||||
							
								
								
									
										63
									
								
								wallet/shelley-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								wallet/shelley-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,63 @@ | ||||
| import { AddressesApi, KeysApi, TransactionsApi, WalletsApi, StakePoolsApi, CoinSelectionsApi } from '../api'; | ||||
| import { Configuration } from '../configuration'; | ||||
| import { ApiWallet, WalletsAssets, WalletsBalance, WalletsDelegation, WalletsPassphrase, WalletsState, WalletsTip } from '../models'; | ||||
| import { AddressWallet } from './address-wallet'; | ||||
| import { CoinSelectionWallet } from './coin-selection-wallet'; | ||||
| import { FeeWallet } from './fee-wallet'; | ||||
| import { KeyWallet } from './key-wallet'; | ||||
| import { TransactionWallet } from './transaction-wallet'; | ||||
| import { UtxoStatisticsWallet } from './utxo-statistics-wallet'; | ||||
| import { AssetWallet } from './asset-wallet'; | ||||
| export declare class ShelleyWallet implements ApiWallet { | ||||
|     id: any; | ||||
|     address_pool_gap: any; | ||||
|     balance: WalletsBalance; | ||||
|     assets: WalletsAssets; | ||||
|     delegation: WalletsDelegation; | ||||
|     name: any; | ||||
|     passphrase: WalletsPassphrase; | ||||
|     state: WalletsState; | ||||
|     tip: WalletsTip; | ||||
|     addressesApi: AddressesApi; | ||||
|     keysApi: KeysApi; | ||||
|     transactionsApi: TransactionsApi; | ||||
|     walletsApi: WalletsApi; | ||||
|     config: Configuration; | ||||
|     stakePoolApi: StakePoolsApi; | ||||
|     coinSelectionsApi: CoinSelectionsApi; | ||||
|     constructor(id: any, address_pool_gap: any, balance: WalletsBalance, assets: WalletsAssets, delegation: WalletsDelegation, name: any, passphrase: WalletsPassphrase, state: WalletsState, tip: WalletsTip, config: Configuration); | ||||
|     static from(wallet: ApiWallet, config: Configuration): ShelleyWallet; | ||||
|     rename(name: string): Promise<this>; | ||||
|     updatePassphrase(oldPassphrase: string, newPassphrase: string): Promise<this>; | ||||
|     getUtxoStatistics(): Promise<UtxoStatisticsWallet>; | ||||
|     getTotalBalance(): number; | ||||
|     getAvailableBalance(): number; | ||||
|     getRewardBalance(): number; | ||||
|     getDelegation(): WalletsDelegation; | ||||
|     refresh(): Promise<this>; | ||||
|     delete(): Promise<import("axios").AxiosResponse<void>>; | ||||
|     getAddresses(): Promise<AddressWallet[]>; | ||||
|     getUnusedAddresses(): Promise<AddressWallet[]>; | ||||
|     getUsedAddresses(): Promise<AddressWallet[]>; | ||||
|     getAddressAt(index: number): Promise<AddressWallet>; | ||||
|     getNextAddress(): Promise<AddressWallet>; | ||||
|     getAddressExternalVerificationKey(index: number): Promise<KeyWallet>; | ||||
|     getStakeVerificationKey(index: number): Promise<KeyWallet>; | ||||
|     getTransactions(start?: Date, end?: Date): Promise<TransactionWallet[]>; | ||||
|     getTransaction(txId: string): Promise<TransactionWallet>; | ||||
|     forgetTransaction(txId: string): Promise<boolean>; | ||||
|     estimateFee(addresses: AddressWallet[], amounts: number[], data?: any, assets?: { | ||||
|         [key: string]: AssetWallet[]; | ||||
|     }): Promise<FeeWallet>; | ||||
|     sendPayment(passphrase: any, addresses: AddressWallet[], amounts: number[], data?: any, assets?: { | ||||
|         [key: string]: AssetWallet[]; | ||||
|     }, ttl?: number): Promise<TransactionWallet>; | ||||
|     estimateDelegationFee(): Promise<FeeWallet>; | ||||
|     delegate(poolId: string, passphrase: string): Promise<TransactionWallet>; | ||||
|     withdraw(passphrase: any, addresses: AddressWallet[], amounts: number[]): Promise<TransactionWallet>; | ||||
|     stopDelegation(passphrase: string): Promise<TransactionWallet>; | ||||
|     getCoinSelection(addresses: AddressWallet[], amounts: number[], data?: any, assets?: { | ||||
|         [key: string]: AssetWallet[]; | ||||
|     }): Promise<CoinSelectionWallet>; | ||||
|     private updateData; | ||||
| } | ||||
							
								
								
									
										526
									
								
								wallet/shelley-wallet.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										526
									
								
								wallet/shelley-wallet.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,526 @@ | ||||
| "use strict"; | ||||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||||
|     function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||||
|     return new (P || (P = Promise))(function (resolve, reject) { | ||||
|         function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||||
|         function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||||
|         function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||||
|         step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||||
|     }); | ||||
| }; | ||||
| var __generator = (this && this.__generator) || function (thisArg, body) { | ||||
|     var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||||
|     return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||||
|     function verb(n) { return function (v) { return step([n, v]); }; } | ||||
|     function step(op) { | ||||
|         if (f) throw new TypeError("Generator is already executing."); | ||||
|         while (_) try { | ||||
|             if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||||
|             if (y = 0, t) op = [op[0] & 2, t.value]; | ||||
|             switch (op[0]) { | ||||
|                 case 0: case 1: t = op; break; | ||||
|                 case 4: _.label++; return { value: op[1], done: false }; | ||||
|                 case 5: _.label++; y = op[1]; op = [0]; continue; | ||||
|                 case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||||
|                 default: | ||||
|                     if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||||
|                     if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||||
|                     if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||||
|                     if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||||
|                     if (t[2]) _.ops.pop(); | ||||
|                     _.trys.pop(); continue; | ||||
|             } | ||||
|             op = body.call(thisArg, _); | ||||
|         } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||||
|         if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||||
|     } | ||||
| }; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.ShelleyWallet = void 0; | ||||
| var utils_1 = require("../utils"); | ||||
| var api_1 = require("../api"); | ||||
| var models_1 = require("../models"); | ||||
| var address_wallet_1 = require("./address-wallet"); | ||||
| var coin_selection_wallet_1 = require("./coin-selection-wallet"); | ||||
| var fee_wallet_1 = require("./fee-wallet"); | ||||
| var key_wallet_1 = require("./key-wallet"); | ||||
| var transaction_wallet_1 = require("./transaction-wallet"); | ||||
| var utxo_statistics_wallet_1 = require("./utxo-statistics-wallet"); | ||||
| var ShelleyWallet = /** @class */ (function () { | ||||
|     function ShelleyWallet(id, address_pool_gap, balance, assets, delegation, name, passphrase, state, tip, config) { | ||||
|         this.id = id; | ||||
|         this.address_pool_gap = address_pool_gap; | ||||
|         this.balance = balance; | ||||
|         this.assets = assets; | ||||
|         this.delegation = delegation; | ||||
|         this.name = name; | ||||
|         this.passphrase = passphrase; | ||||
|         this.state = state; | ||||
|         this.tip = tip; | ||||
|         this.config = config; | ||||
|         this.addressesApi = new api_1.AddressesApi(config); | ||||
|         this.keysApi = new api_1.KeysApi(config); | ||||
|         this.transactionsApi = new api_1.TransactionsApi(config); | ||||
|         this.walletsApi = new api_1.WalletsApi(config); | ||||
|         this.stakePoolApi = new api_1.StakePoolsApi(config); | ||||
|         this.coinSelectionsApi = new api_1.CoinSelectionsApi(config); | ||||
|     } | ||||
|     ShelleyWallet.from = function (wallet, config) { | ||||
|         return new this(wallet.id, wallet.address_pool_gap, wallet.balance, wallet.assets, wallet.delegation, wallet.name, wallet.passphrase, wallet.state, wallet.tip, config); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.rename = function (name) { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var payload, res; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: | ||||
|                         payload = { | ||||
|                             name: name | ||||
|                         }; | ||||
|                         return [4 /*yield*/, this.walletsApi.putWallet(payload, this.id)]; | ||||
|                     case 1: | ||||
|                         res = _a.sent(); | ||||
|                         this.updateData(res.data); | ||||
|                         return [2 /*return*/, this]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.updatePassphrase = function (oldPassphrase, newPassphrase) { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var paylaod, res; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: | ||||
|                         paylaod = { | ||||
|                             old_passphrase: oldPassphrase, | ||||
|                             new_passphrase: newPassphrase | ||||
|                         }; | ||||
|                         return [4 /*yield*/, this.walletsApi.putWalletPassphrase(paylaod, this.id)]; | ||||
|                     case 1: | ||||
|                         _a.sent(); | ||||
|                         return [4 /*yield*/, this.walletsApi.getWallet(this.id)]; | ||||
|                     case 2: | ||||
|                         res = _a.sent(); | ||||
|                         this.updateData(res.data); | ||||
|                         return [2 /*return*/, this]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.getUtxoStatistics = function () { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var res; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: return [4 /*yield*/, this.walletsApi.getUTxOsStatistics(this.id)]; | ||||
|                     case 1: | ||||
|                         res = _a.sent(); | ||||
|                         return [2 /*return*/, utxo_statistics_wallet_1.UtxoStatisticsWallet.from(res.data)]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.getTotalBalance = function () { | ||||
|         return this.balance.total.quantity; | ||||
|     }; | ||||
|     ShelleyWallet.prototype.getAvailableBalance = function () { | ||||
|         return this.balance.available.quantity; | ||||
|     }; | ||||
|     ShelleyWallet.prototype.getRewardBalance = function () { | ||||
|         return this.balance.reward.quantity; | ||||
|     }; | ||||
|     ShelleyWallet.prototype.getDelegation = function () { | ||||
|         return this.delegation; | ||||
|     }; | ||||
|     ShelleyWallet.prototype.refresh = function () { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var res; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: return [4 /*yield*/, this.walletsApi.getWallet(this.id)]; | ||||
|                     case 1: | ||||
|                         res = _a.sent(); | ||||
|                         this.updateData(res.data); | ||||
|                         return [2 /*return*/, this]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.delete = function () { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: return [4 /*yield*/, this.walletsApi.deleteWallet(this.id)]; | ||||
|                     case 1: return [2 /*return*/, _a.sent()]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.getAddresses = function () { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var res; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: return [4 /*yield*/, this.addressesApi.listAddresses(this.id)]; | ||||
|                     case 1: | ||||
|                         res = _a.sent(); | ||||
|                         return [2 /*return*/, res.data.map(function (addr) { return new address_wallet_1.AddressWallet(addr.id, addr.state); })]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.getUnusedAddresses = function () { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var res; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: return [4 /*yield*/, this.addressesApi.listAddresses(this.id, models_1.ApiAddressStateEnum.Unused)]; | ||||
|                     case 1: | ||||
|                         res = _a.sent(); | ||||
|                         return [2 /*return*/, res.data.map(function (addr) { return new address_wallet_1.AddressWallet(addr.id, addr.state); })]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.getUsedAddresses = function () { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var res; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: return [4 /*yield*/, this.addressesApi.listAddresses(this.id, models_1.ApiAddressStateEnum.Used)]; | ||||
|                     case 1: | ||||
|                         res = _a.sent(); | ||||
|                         return [2 /*return*/, res.data.map(function (addr) { return new address_wallet_1.AddressWallet(addr.id, addr.state); })]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.getAddressAt = function (index) { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var addressVk, stakeVk, payload, next; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: return [4 /*yield*/, this.getAddressExternalVerificationKey(index)]; | ||||
|                     case 1: | ||||
|                         addressVk = _a.sent(); | ||||
|                         return [4 /*yield*/, this.getStakeVerificationKey(0)]; | ||||
|                     case 2: | ||||
|                         stakeVk = _a.sent(); | ||||
|                         payload = { | ||||
|                             payment: addressVk.key, | ||||
|                             stake: stakeVk.key | ||||
|                         }; | ||||
|                         return [4 /*yield*/, this.addressesApi.postAnyAddress(payload)]; | ||||
|                     case 3: | ||||
|                         next = _a.sent(); | ||||
|                         return [2 /*return*/, new address_wallet_1.AddressWallet(next.data.address)]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.getNextAddress = function () { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var index; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: return [4 /*yield*/, this.getAddresses()]; | ||||
|                     case 1: | ||||
|                         index = (_a.sent()).length; | ||||
|                         return [2 /*return*/, this.getAddressAt(index)]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.getAddressExternalVerificationKey = function (index) { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var account; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: return [4 /*yield*/, this.keysApi.getWalletKey(this.id, key_wallet_1.KeyRoleEnum.AddressExternal, index.toString())]; | ||||
|                     case 1: | ||||
|                         account = _a.sent(); | ||||
|                         return [2 /*return*/, new key_wallet_1.KeyWallet(account.data, key_wallet_1.KeyRoleEnum.AddressExternal)]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.getStakeVerificationKey = function (index) { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var account; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: return [4 /*yield*/, this.keysApi.getWalletKey(this.id, key_wallet_1.KeyRoleEnum.Stake, index.toString())]; | ||||
|                     case 1: | ||||
|                         account = _a.sent(); | ||||
|                         return [2 /*return*/, new key_wallet_1.KeyWallet(account.data, key_wallet_1.KeyRoleEnum.Stake)]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.getTransactions = function (start, end) { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var startdate, enddate, res; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: | ||||
|                         startdate = start ? start.toISOString() : undefined; | ||||
|                         enddate = end ? end.toISOString() : undefined; | ||||
|                         return [4 /*yield*/, this.transactionsApi.listTransactions(this.id, startdate, enddate)]; | ||||
|                     case 1: | ||||
|                         res = _a.sent(); | ||||
|                         return [2 /*return*/, res.data.map(function (data) { return transaction_wallet_1.TransactionWallet.from(data); })]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.getTransaction = function (txId) { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var res; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: return [4 /*yield*/, this.transactionsApi.getTransaction(this.id, txId)]; | ||||
|                     case 1: | ||||
|                         res = _a.sent(); | ||||
|                         return [2 /*return*/, transaction_wallet_1.TransactionWallet.from(res.data)]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.forgetTransaction = function (txId) { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var res; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: return [4 /*yield*/, this.transactionsApi.deleteTransaction(this.id, txId)]; | ||||
|                     case 1: | ||||
|                         res = _a.sent(); | ||||
|                         return [2 /*return*/, res.status == 204]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.estimateFee = function (addresses, amounts, data, assets) { | ||||
|         if (assets === void 0) { assets = {}; } | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var metadata, payload, res; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: | ||||
|                         metadata = data ? utils_1.Seed.constructMetadata(data) : undefined; | ||||
|                         payload = { | ||||
|                             payments: addresses.map(function (addr, i) { | ||||
|                                 var _a; | ||||
|                                 var amount = { | ||||
|                                     unit: models_1.WalletswalletIdpaymentfeesAmountUnitEnum.Lovelace, | ||||
|                                     quantity: amounts[i] | ||||
|                                 }; | ||||
|                                 var payment = { | ||||
|                                     address: addr.address, | ||||
|                                     amount: amount, | ||||
|                                     assets: (_a = assets[addr.id]) === null || _a === void 0 ? void 0 : _a.map(function (a) { | ||||
|                                         var asset = { | ||||
|                                             policy_id: a.policy_id, | ||||
|                                             asset_name: Buffer.from(a.asset_name).toString('hex'), | ||||
|                                             quantity: a.quantity | ||||
|                                         }; | ||||
|                                         return asset; | ||||
|                                     }) | ||||
|                                 }; | ||||
|                                 return payment; | ||||
|                             }), | ||||
|                             metadata: metadata | ||||
|                         }; | ||||
|                         return [4 /*yield*/, this.transactionsApi.postTransactionFee(payload, this.id)]; | ||||
|                     case 1: | ||||
|                         res = _a.sent(); | ||||
|                         return [2 /*return*/, fee_wallet_1.FeeWallet.from(res.data)]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.sendPayment = function (passphrase, addresses, amounts, data, assets, ttl) { | ||||
|         if (assets === void 0) { assets = {}; } | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var metadata, time_to_leave, payload, res; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: | ||||
|                         metadata = data ? utils_1.Seed.constructMetadata(data) : undefined; | ||||
|                         time_to_leave = ttl | ||||
|                             ? { | ||||
|                                 quantity: ttl, | ||||
|                                 unit: models_1.WalletswalletIdpaymentfeesTimeToLiveUnitEnum.Second | ||||
|                             } | ||||
|                             : undefined; | ||||
|                         payload = { | ||||
|                             passphrase: passphrase, | ||||
|                             payments: addresses.map(function (addr, i) { | ||||
|                                 var _a; | ||||
|                                 var amount = { | ||||
|                                     unit: models_1.WalletswalletIdpaymentfeesAmountUnitEnum.Lovelace, | ||||
|                                     quantity: amounts[i] | ||||
|                                 }; | ||||
|                                 var payment = { | ||||
|                                     address: addr.address, | ||||
|                                     amount: amount, | ||||
|                                     assets: (_a = assets[addr.id]) === null || _a === void 0 ? void 0 : _a.map(function (a) { | ||||
|                                         var asset = { | ||||
|                                             policy_id: a.policy_id, | ||||
|                                             asset_name: a.asset_name, | ||||
|                                             quantity: a.quantity | ||||
|                                         }; | ||||
|                                         return asset; | ||||
|                                     }) | ||||
|                                 }; | ||||
|                                 return payment; | ||||
|                             }), | ||||
|                             metadata: metadata, | ||||
|                             time_to_live: time_to_leave | ||||
|                         }; | ||||
|                         return [4 /*yield*/, this.transactionsApi.postTransaction(payload, this.id)]; | ||||
|                     case 1: | ||||
|                         res = _a.sent(); | ||||
|                         return [2 /*return*/, transaction_wallet_1.TransactionWallet.from(res.data)]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.estimateDelegationFee = function () { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var res; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: return [4 /*yield*/, this.stakePoolApi.getDelegationFee(this.id)]; | ||||
|                     case 1: | ||||
|                         res = _a.sent(); | ||||
|                         return [2 /*return*/, fee_wallet_1.FeeWallet.from(res.data)]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.delegate = function (poolId, passphrase) { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var payload, res; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: | ||||
|                         payload = { | ||||
|                             passphrase: passphrase | ||||
|                         }; | ||||
|                         return [4 /*yield*/, this.stakePoolApi.joinStakePool(payload, poolId, this.id)]; | ||||
|                     case 1: | ||||
|                         res = _a.sent(); | ||||
|                         return [2 /*return*/, transaction_wallet_1.TransactionWallet.from(res.data)]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.withdraw = function (passphrase, addresses, amounts) { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var payload, res; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: | ||||
|                         payload = { | ||||
|                             passphrase: passphrase, | ||||
|                             payments: addresses.map(function (addr, i) { | ||||
|                                 var amount = { | ||||
|                                     unit: models_1.WalletswalletIdpaymentfeesAmountUnitEnum.Lovelace, | ||||
|                                     quantity: amounts[i] | ||||
|                                 }; | ||||
|                                 var payment = { | ||||
|                                     address: addr.address, | ||||
|                                     amount: amount | ||||
|                                 }; | ||||
|                                 return payment; | ||||
|                             }), | ||||
|                             withdrawal: models_1.ApiPostTransactionDataWithdrawalEnum.Self | ||||
|                         }; | ||||
|                         return [4 /*yield*/, this.transactionsApi.postTransaction(payload, this.id)]; | ||||
|                     case 1: | ||||
|                         res = _a.sent(); | ||||
|                         return [2 /*return*/, transaction_wallet_1.TransactionWallet.from(res.data)]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.stopDelegation = function (passphrase) { | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var payload, res; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: | ||||
|                         payload = { | ||||
|                             passphrase: passphrase | ||||
|                         }; | ||||
|                         return [4 /*yield*/, this.stakePoolApi.quitStakePool(payload, this.id)]; | ||||
|                     case 1: | ||||
|                         res = _a.sent(); | ||||
|                         return [2 /*return*/, transaction_wallet_1.TransactionWallet.from(res.data)]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.getCoinSelection = function (addresses, amounts, data, assets) { | ||||
|         if (assets === void 0) { assets = {}; } | ||||
|         return __awaiter(this, void 0, void 0, function () { | ||||
|             var metadata, payload, res, err_1, error; | ||||
|             return __generator(this, function (_a) { | ||||
|                 switch (_a.label) { | ||||
|                     case 0: | ||||
|                         _a.trys.push([0, 2, , 3]); | ||||
|                         metadata = data ? utils_1.Seed.constructMetadata(data) : undefined; | ||||
|                         payload = { | ||||
|                             payments: addresses.map(function (addr, i) { | ||||
|                                 var _a; | ||||
|                                 var amount = amounts[i] | ||||
|                                     ? { | ||||
|                                         unit: models_1.WalletswalletIdpaymentfeesAmountUnitEnum.Lovelace, | ||||
|                                         quantity: amounts[i] | ||||
|                                     } | ||||
|                                     : undefined; | ||||
|                                 var payment = { | ||||
|                                     address: addr.address, | ||||
|                                     amount: amount, | ||||
|                                     assets: (_a = assets[addr.id]) === null || _a === void 0 ? void 0 : _a.map(function (a) { | ||||
|                                         var asset = { | ||||
|                                             policy_id: a.policy_id, | ||||
|                                             //  asset_name: Buffer.from(a.asset_name).toString('hex'), | ||||
|                                             asset_name: a.asset_name, | ||||
|                                             quantity: a.quantity | ||||
|                                         }; | ||||
|                                         return asset; | ||||
|                                     }) | ||||
|                                 }; | ||||
|                                 return payment; | ||||
|                             }), | ||||
|                             metadata: metadata | ||||
|                         }; | ||||
|                         return [4 /*yield*/, this.coinSelectionsApi.selectCoins(payload, this.id)]; | ||||
|                     case 1: | ||||
|                         res = _a.sent(); | ||||
|                         return [2 /*return*/, coin_selection_wallet_1.CoinSelectionWallet.from(res.data)]; | ||||
|                     case 2: | ||||
|                         err_1 = _a.sent(); | ||||
|                         error = err_1; | ||||
|                         return [2 /*return*/, null]; | ||||
|                     case 3: return [2 /*return*/]; | ||||
|                 } | ||||
|             }); | ||||
|         }); | ||||
|     }; | ||||
|     ShelleyWallet.prototype.updateData = function (data) { | ||||
|         this.address_pool_gap = data.address_pool_gap; | ||||
|         this.balance = data.balance; | ||||
|         this.assets = data.assets; | ||||
|         this.delegation = data.delegation; | ||||
|         this.name = data.name; | ||||
|         this.passphrase = data.passphrase; | ||||
|         this.state = data.state; | ||||
|         this.tip = data.tip; | ||||
|     }; | ||||
|     return ShelleyWallet; | ||||
| }()); | ||||
| exports.ShelleyWallet = ShelleyWallet; | ||||
| //# sourceMappingURL=shelley-wallet.js.map | ||||
							
								
								
									
										1
									
								
								wallet/shelley-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								wallet/shelley-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										13
									
								
								wallet/stakepool-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								wallet/stakepool-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| import { ApiStakePool, ApiStakePoolFlagsEnum, StakepoolsCost, StakepoolsMargin, StakepoolsMetadata, StakepoolsMetrics, StakepoolsPledge, StakepoolsRetirement } from '../models'; | ||||
| export declare class StakePoolWallet implements ApiStakePool { | ||||
|     id: any; | ||||
|     metrics: StakepoolsMetrics; | ||||
|     cost: StakepoolsCost; | ||||
|     margin: StakepoolsMargin; | ||||
|     pledge: StakepoolsPledge; | ||||
|     metadata?: StakepoolsMetadata; | ||||
|     retirement?: StakepoolsRetirement; | ||||
|     flags: ApiStakePoolFlagsEnum[]; | ||||
|     constructor(id: any, metrics: StakepoolsMetrics, cost: StakepoolsCost, margin: StakepoolsMargin, pledge: StakepoolsPledge, metadata: StakepoolsMetadata, retirement: StakepoolsRetirement, flags: ApiStakePoolFlagsEnum[]); | ||||
|     static from(apiStakePool: ApiStakePool): StakePoolWallet; | ||||
| } | ||||
							
								
								
									
										21
									
								
								wallet/stakepool-wallet.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								wallet/stakepool-wallet.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.StakePoolWallet = void 0; | ||||
| var StakePoolWallet = /** @class */ (function () { | ||||
|     function StakePoolWallet(id, metrics, cost, margin, pledge, metadata, retirement, flags) { | ||||
|         this.id = id; | ||||
|         this.metrics = metrics; | ||||
|         this.cost = cost; | ||||
|         this.margin = margin; | ||||
|         this.pledge = pledge; | ||||
|         this.metadata = metadata; | ||||
|         this.retirement = retirement; | ||||
|         this.flags = flags; | ||||
|     } | ||||
|     StakePoolWallet.from = function (apiStakePool) { | ||||
|         return new this(apiStakePool.id, apiStakePool.metrics, apiStakePool.cost, apiStakePool.margin, apiStakePool.pledge, apiStakePool.metadata, apiStakePool.retirement, apiStakePool.flags); | ||||
|     }; | ||||
|     return StakePoolWallet; | ||||
| }()); | ||||
| exports.StakePoolWallet = StakePoolWallet; | ||||
| //# sourceMappingURL=stakepool-wallet.js.map | ||||
							
								
								
									
										1
									
								
								wallet/stakepool-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								wallet/stakepool-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| {"version":3,"file":"stakepool-wallet.js","sourceRoot":"","sources":["../../wallet/stakepool-wallet.ts"],"names":[],"mappings":";;;AAWA;IAUE,yBACE,EAAO,EACP,OAA0B,EAC1B,IAAoB,EACpB,MAAwB,EACxB,MAAwB,EACxB,QAA4B,EAC5B,UAAgC,EAChC,KAA8B;QAE9B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAEM,oBAAI,GAAX,UAAY,YAA0B;QACpC,OAAO,IAAI,IAAI,CACb,YAAY,CAAC,EAAE,EACf,YAAY,CAAC,OAAO,EACpB,YAAY,CAAC,IAAI,EACjB,YAAY,CAAC,MAAM,EACnB,YAAY,CAAC,MAAM,EACnB,YAAY,CAAC,QAAQ,EACrB,YAAY,CAAC,UAAU,EACvB,YAAY,CAAC,KAAK,CACnB,CAAA;IACH,CAAC;IACH,sBAAC;AAAD,CAAC,AA1CD,IA0CC;AA1CY,0CAAe"} | ||||
							
								
								
									
										9
									
								
								wallet/token-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								wallet/token-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| import { NativeScript } from '@emurgo/cardano-serialization-lib-nodejs'; | ||||
| import { Bip32KeyPair } from '../utils'; | ||||
| import { AssetWallet } from './asset-wallet'; | ||||
| export declare class TokenWallet { | ||||
|     asset: AssetWallet; | ||||
|     script?: NativeScript; | ||||
|     scriptKeyPairs?: Bip32KeyPair[]; | ||||
|     constructor(asset: AssetWallet, script?: NativeScript, scriptKeyPairs?: Bip32KeyPair[]); | ||||
| } | ||||
							
								
								
									
										13
									
								
								wallet/token-wallet.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								wallet/token-wallet.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.TokenWallet = void 0; | ||||
| var TokenWallet = /** @class */ (function () { | ||||
|     function TokenWallet(asset, script, scriptKeyPairs) { | ||||
|         this.asset = asset; | ||||
|         this.script = script; | ||||
|         this.scriptKeyPairs = scriptKeyPairs; | ||||
|     } | ||||
|     return TokenWallet; | ||||
| }()); | ||||
| exports.TokenWallet = TokenWallet; | ||||
| //# sourceMappingURL=token-wallet.js.map | ||||
							
								
								
									
										1
									
								
								wallet/token-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								wallet/token-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| {"version":3,"file":"token-wallet.js","sourceRoot":"","sources":["../../wallet/token-wallet.ts"],"names":[],"mappings":";;;AAIA;IAKE,qBACE,KAAkB,EAClB,MAAqB,EACrB,cAA+B;QAE/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAA;IACtC,CAAC;IACH,kBAAC;AAAD,CAAC,AAdD,IAcC;AAdY,kCAAW"} | ||||
							
								
								
									
										20
									
								
								wallet/transaction-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								wallet/transaction-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| import { ApiTransaction, ApiTransactionDirectionEnum, ApiTransactionStatusEnum, WalletswalletIdpaymentfeesAmount, WalletswalletIdpaymentfeesPayments, WalletswalletIdtransactionsAmount, WalletswalletIdtransactionsDepth, WalletswalletIdtransactionsExpiresAt, WalletswalletIdtransactionsInputs, WalletswalletIdtransactionsInsertedAt, WalletswalletIdtransactionsMint, WalletswalletIdtransactionsPendingSince, WalletswalletIdtransactionsWithdrawals } from '../models'; | ||||
| export declare class TransactionWallet implements ApiTransaction { | ||||
|     id: any; | ||||
|     amount: WalletswalletIdtransactionsAmount; | ||||
|     fee: WalletswalletIdpaymentfeesAmount; | ||||
|     deposit: WalletswalletIdpaymentfeesAmount; | ||||
|     inserted_at?: WalletswalletIdtransactionsInsertedAt; | ||||
|     expires_at?: WalletswalletIdtransactionsExpiresAt; | ||||
|     pending_since?: WalletswalletIdtransactionsPendingSince; | ||||
|     depth?: WalletswalletIdtransactionsDepth; | ||||
|     direction: ApiTransactionDirectionEnum; | ||||
|     inputs: WalletswalletIdtransactionsInputs[]; | ||||
|     outputs: Array<WalletswalletIdpaymentfeesPayments>; | ||||
|     withdrawals: WalletswalletIdtransactionsWithdrawals[]; | ||||
|     mint: WalletswalletIdtransactionsMint[]; | ||||
|     status: ApiTransactionStatusEnum; | ||||
|     metadata?: any; | ||||
|     constructor(id: any, amount: WalletswalletIdtransactionsAmount, fee: WalletswalletIdpaymentfeesAmount, deposit: WalletswalletIdpaymentfeesAmount, inserted_at: WalletswalletIdtransactionsInsertedAt, expires_at: WalletswalletIdtransactionsExpiresAt, pending_since: WalletswalletIdtransactionsPendingSince, depth: WalletswalletIdtransactionsDepth, direction: ApiTransactionDirectionEnum, inputs: WalletswalletIdtransactionsInputs[], outputs: Array<WalletswalletIdpaymentfeesPayments>, withdrawals: WalletswalletIdtransactionsWithdrawals[], mint: WalletswalletIdtransactionsMint[], status: ApiTransactionStatusEnum, metadata: any); | ||||
|     static from(tx: ApiTransaction): TransactionWallet; | ||||
| } | ||||
							
								
								
									
										28
									
								
								wallet/transaction-wallet.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								wallet/transaction-wallet.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.TransactionWallet = void 0; | ||||
| var TransactionWallet = /** @class */ (function () { | ||||
|     function TransactionWallet(id, amount, fee, deposit, inserted_at, expires_at, pending_since, depth, direction, inputs, outputs, withdrawals, mint, status, metadata) { | ||||
|         this.id = id; | ||||
|         this.amount = amount; | ||||
|         this.fee = fee; | ||||
|         this.deposit = deposit; | ||||
|         this.direction = direction; | ||||
|         this.inserted_at = inserted_at; | ||||
|         this.expires_at = expires_at; | ||||
|         this.pending_since = pending_since; | ||||
|         this.depth = depth; | ||||
|         this.inputs = inputs; | ||||
|         this.outputs = outputs; | ||||
|         this.withdrawals = withdrawals; | ||||
|         this.mint = mint; | ||||
|         this.status = status; | ||||
|         this.metadata = metadata; | ||||
|     } | ||||
|     TransactionWallet.from = function (tx) { | ||||
|         return new this(tx.id, tx.amount, tx.fee, tx.deposit, tx.inserted_at, tx.expires_at, tx.pending_since, tx.depth, tx.direction, tx.inputs, tx.outputs, tx.withdrawals, tx.mint, tx.status, tx.metadata); | ||||
|     }; | ||||
|     return TransactionWallet; | ||||
| }()); | ||||
| exports.TransactionWallet = TransactionWallet; | ||||
| //# sourceMappingURL=transaction-wallet.js.map | ||||
							
								
								
									
										1
									
								
								wallet/transaction-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								wallet/transaction-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| {"version":3,"file":"transaction-wallet.js","sourceRoot":"","sources":["../../wallet/transaction-wallet.ts"],"names":[],"mappings":";;;AAgBA;IAiBE,2BACE,EAAO,EACP,MAAyC,EACzC,GAAqC,EACrC,OAAyC,EACzC,WAAkD,EAClD,UAAgD,EAChD,aAAsD,EACtD,KAAuC,EACvC,SAAsC,EACtC,MAA2C,EAC3C,OAAkD,EAClD,WAAqD,EACrD,IAAuC,EACvC,MAAgC,EAChC,QAAa;QAEb,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAEM,sBAAI,GAAX,UAAY,EAAkB;QAC5B,OAAO,IAAI,IAAI,CACb,EAAE,CAAC,EAAE,EACL,EAAE,CAAC,MAAM,EACT,EAAE,CAAC,GAAG,EACN,EAAE,CAAC,OAAO,EACV,EAAE,CAAC,WAAW,EACd,EAAE,CAAC,UAAU,EACb,EAAE,CAAC,aAAa,EAChB,EAAE,CAAC,KAAK,EACR,EAAE,CAAC,SAAS,EACZ,EAAE,CAAC,MAAM,EACT,EAAE,CAAC,OAAO,EACV,EAAE,CAAC,WAAW,EACd,EAAE,CAAC,IAAI,EACP,EAAE,CAAC,MAAM,EACT,EAAE,CAAC,QAAQ,CACZ,CAAA;IACH,CAAC;IACH,wBAAC;AAAD,CAAC,AAtED,IAsEC;AAtEY,8CAAiB"} | ||||
							
								
								
									
										8
									
								
								wallet/utxo-statistics-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								wallet/utxo-statistics-wallet.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| import { ApiWalletUTxOsStatistics, ApiWalletUTxOsStatisticsScaleEnum, WalletswalletIdpaymentfeesAmount } from '../models'; | ||||
| export declare class UtxoStatisticsWallet implements ApiWalletUTxOsStatistics { | ||||
|     total: WalletswalletIdpaymentfeesAmount; | ||||
|     scale: ApiWalletUTxOsStatisticsScaleEnum; | ||||
|     distribution: any; | ||||
|     constructor(total: WalletswalletIdpaymentfeesAmount, scale: ApiWalletUTxOsStatisticsScaleEnum, distribution: any); | ||||
|     static from(utxoStatistics: ApiWalletUTxOsStatistics): UtxoStatisticsWallet; | ||||
| } | ||||
							
								
								
									
										16
									
								
								wallet/utxo-statistics-wallet.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								wallet/utxo-statistics-wallet.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| "use strict"; | ||||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||||
| exports.UtxoStatisticsWallet = void 0; | ||||
| var UtxoStatisticsWallet = /** @class */ (function () { | ||||
|     function UtxoStatisticsWallet(total, scale, distribution) { | ||||
|         this.total = total; | ||||
|         this.scale = scale; | ||||
|         this.distribution = distribution; | ||||
|     } | ||||
|     UtxoStatisticsWallet.from = function (utxoStatistics) { | ||||
|         return new this(utxoStatistics.total, utxoStatistics.scale, utxoStatistics.distribution); | ||||
|     }; | ||||
|     return UtxoStatisticsWallet; | ||||
| }()); | ||||
| exports.UtxoStatisticsWallet = UtxoStatisticsWallet; | ||||
| //# sourceMappingURL=utxo-statistics-wallet.js.map | ||||
							
								
								
									
										1
									
								
								wallet/utxo-statistics-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								wallet/utxo-statistics-wallet.js.map
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| {"version":3,"file":"utxo-statistics-wallet.js","sourceRoot":"","sources":["../../wallet/utxo-statistics-wallet.ts"],"names":[],"mappings":";;;AAMA;IAKE,8BACE,KAAuC,EACvC,KAAwC,EACxC,YAAiB;QAEjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,CAAC;IAEM,yBAAI,GAAX,UAAY,cAAwC;QAClD,OAAO,IAAI,IAAI,CACb,cAAc,CAAC,KAAK,EACpB,cAAc,CAAC,KAAK,EACpB,cAAc,CAAC,YAAY,CAC5B,CAAA;IACH,CAAC;IACH,2BAAC;AAAD,CAAC,AAtBD,IAsBC;AAtBY,oDAAoB"} | ||||
		Reference in New Issue
	
	Block a user