@cardano-sdk/core 0.46.10 → 0.46.12

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.
@@ -1,2 +1,5 @@
1
+ import type { TxIn, Utxo } from '../Cardano';
1
2
  export declare const createUtxoId: (txHash: string, index: number) => string;
3
+ export declare const sortTxIn: (lhs: TxIn, rhs: TxIn) => number;
4
+ export declare const sortUtxoByTxIn: (lhs: Utxo, rhs: Utxo) => number;
2
5
  //# sourceMappingURL=utxo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["../../../src/util/utxo.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,WAAY,MAAM,SAAS,MAAM,WAAyB,CAAC"}
1
+ {"version":3,"file":"utxo.d.ts","sourceRoot":"","sources":["../../../src/util/utxo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,YAAY,WAAY,MAAM,SAAS,MAAM,WAAyB,CAAC;AAQpF,eAAO,MAAM,QAAQ,QAAS,IAAI,OAAO,IAAI,WAK5C,CAAC;AAQF,eAAO,MAAM,cAAc,kCAAqD,CAAC"}
@@ -1,6 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createUtxoId = void 0;
3
+ exports.sortUtxoByTxIn = exports.sortTxIn = exports.createUtxoId = void 0;
4
4
  const createUtxoId = (txHash, index) => `${txHash}:${index}`;
5
5
  exports.createUtxoId = createUtxoId;
6
+ const sortTxIn = (lhs, rhs) => {
7
+ const txIdComparison = lhs.txId.localeCompare(rhs.txId);
8
+ if (txIdComparison !== 0)
9
+ return txIdComparison;
10
+ return lhs.index - rhs.index;
11
+ };
12
+ exports.sortTxIn = sortTxIn;
13
+ const sortUtxoByTxIn = (lhs, rhs) => (0, exports.sortTxIn)(lhs[0], rhs[0]);
14
+ exports.sortUtxoByTxIn = sortUtxoByTxIn;
6
15
  //# sourceMappingURL=utxo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utxo.js","sourceRoot":"","sources":["../../../src/util/utxo.ts"],"names":[],"mappings":";;;AAAO,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,KAAa,EAAE,EAAE,CAAC,GAAG,MAAM,IAAI,KAAK,EAAE,CAAC;AAAvE,QAAA,YAAY,gBAA2D"}
1
+ {"version":3,"file":"utxo.js","sourceRoot":"","sources":["../../../src/util/utxo.ts"],"names":[],"mappings":";;;AAEO,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,KAAa,EAAE,EAAE,CAAC,GAAG,MAAM,IAAI,KAAK,EAAE,CAAC;AAAvE,QAAA,YAAY,gBAA2D;AAQ7E,MAAM,QAAQ,GAAG,CAAC,GAAS,EAAE,GAAS,EAAE,EAAE;IAC/C,MAAM,cAAc,GAAG,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACxD,IAAI,cAAc,KAAK,CAAC;QAAE,OAAO,cAAc,CAAC;IAEhD,OAAO,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;AAC/B,CAAC,CAAC;AALW,QAAA,QAAQ,YAKnB;AAQK,MAAM,cAAc,GAAG,CAAC,GAAS,EAAE,GAAS,EAAE,EAAE,CAAC,IAAA,gBAAQ,EAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAApE,QAAA,cAAc,kBAAsD"}
@@ -0,0 +1,8 @@
1
+ import { Credential } from './Address.js';
2
+ import { OpaqueString } from '@cardano-sdk/util';
3
+ export declare type PaymentCredential = OpaqueString<'PaymentCredential'>;
4
+ export declare const PaymentCredential: {
5
+ (value: string): PaymentCredential;
6
+ fromCredential(credential: Credential): PaymentCredential;
7
+ };
8
+ //# sourceMappingURL=PaymentCredential.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaymentCredential.d.ts","sourceRoot":"","sources":["../../../../src/Cardano/Address/PaymentCredential.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAkB,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,YAAY,EAAe,MAAM,mBAAmB,CAAC;AAG9D,oBAAY,iBAAiB,GAAG,YAAY,CAAC,mBAAmB,CAAC,CAAC;AAMlE,eAAO,MAAM,iBAAiB;YAAW,MAAM,GAAG,iBAAiB;+BAcnB,UAAU,GAAG,iBAAiB;CAR7E,CAAC"}
@@ -0,0 +1,17 @@
1
+ import * as BaseEncoding from '@scure/base';
2
+ import { CredentialType } from './Address.js';
3
+ import { typedBech32 } from '@cardano-sdk/util';
4
+ export const PaymentCredential = (value) => {
5
+ try {
6
+ return typedBech32(value, ['addr_vkh'], 45);
7
+ }
8
+ catch {
9
+ return typedBech32(value, ['script'], 45);
10
+ }
11
+ };
12
+ PaymentCredential.fromCredential = (credential) => {
13
+ const words = BaseEncoding.bech32.toWords(Buffer.from(credential.hash, 'hex'));
14
+ const prefix = credential.type === CredentialType.KeyHash ? 'addr_vkh' : 'script';
15
+ return BaseEncoding.bech32.encode(prefix, words, 1023);
16
+ };
17
+ //# sourceMappingURL=PaymentCredential.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaymentCredential.js","sourceRoot":"","sources":["../../../../src/Cardano/Address/PaymentCredential.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAc,cAAc,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAgB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAS9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAqB,EAAE;IACpE,IAAI;QACF,OAAO,WAAW,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;KAC7C;IAAC,MAAM;QACN,OAAO,WAAW,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;KAC3C;AACH,CAAC,CAAC;AAQF,iBAAiB,CAAC,cAAc,GAAG,CAAC,UAAsB,EAAqB,EAAE;IAC/E,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/E,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,KAAK,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC;IAClF,OAAO,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAsB,CAAC;AAC9E,CAAC,CAAC"}
@@ -4,6 +4,7 @@ export * from './ByronAddress.js';
4
4
  export * from './DRepID.js';
5
5
  export * from './EnterpriseAddress.js';
6
6
  export * from './PaymentAddress.js';
7
+ export * from './PaymentCredential.js';
7
8
  export * from './PointerAddress.js';
8
9
  export * from './RewardAccount.js';
9
10
  export * from './RewardAddress.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Cardano/Address/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/Cardano/Address/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
@@ -4,6 +4,7 @@ export * from './ByronAddress.js';
4
4
  export * from './DRepID.js';
5
5
  export * from './EnterpriseAddress.js';
6
6
  export * from './PaymentAddress.js';
7
+ export * from './PaymentCredential.js';
7
8
  export * from './PointerAddress.js';
8
9
  export * from './RewardAccount.js';
9
10
  export * from './RewardAddress.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Cardano/Address/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/Cardano/Address/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}