@canton-network/core-wallet-store-sql 1.2.2 → 1.3.1
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.cjs +114 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +114 -0
- package/dist/index.js.map +1 -1
- package/dist/migrations/012-add-messages-to-sign.d.ts +4 -0
- package/dist/migrations/012-add-messages-to-sign.d.ts.map +1 -0
- package/dist/migrations/012-add-messages-to-sign.js +27 -0
- package/dist/migrations-test/global-setup.d.ts +9 -0
- package/dist/migrations-test/global-setup.d.ts.map +1 -0
- package/dist/migrations-test/helpers.d.ts +32 -0
- package/dist/migrations-test/helpers.d.ts.map +1 -0
- package/dist/migrations-test/seeds/001-init.d.ts +43 -0
- package/dist/migrations-test/seeds/001-init.d.ts.map +1 -0
- package/dist/migrations-test/seeds/002-transaction-timestamps.d.ts +13 -0
- package/dist/migrations-test/seeds/002-transaction-timestamps.d.ts.map +1 -0
- package/dist/migrations-test/seeds/003-transaction-origin.d.ts +14 -0
- package/dist/migrations-test/seeds/003-transaction-origin.d.ts.map +1 -0
- package/dist/migrations-test/seeds/004-add-session-id.d.ts +9 -0
- package/dist/migrations-test/seeds/004-add-session-id.d.ts.map +1 -0
- package/dist/migrations-test/seeds/005-add-wallet-disabled-reason.d.ts +16 -0
- package/dist/migrations-test/seeds/005-add-wallet-disabled-reason.d.ts.map +1 -0
- package/dist/migrations-test/seeds/008-transaction-external-tx-id.d.ts +15 -0
- package/dist/migrations-test/seeds/008-transaction-external-tx-id.d.ts.map +1 -0
- package/dist/migrations-test/seeds/009-add-wallet-rights-columns.d.ts +14 -0
- package/dist/migrations-test/seeds/009-add-wallet-rights-columns.d.ts.map +1 -0
- package/dist/migrations-test/seeds/010-transaction-with-network.d.ts +16 -0
- package/dist/migrations-test/seeds/010-transaction-with-network.d.ts.map +1 -0
- package/dist/migrations-test/seeds/012-add-messages-to-sign.d.ts +16 -0
- package/dist/migrations-test/seeds/012-add-messages-to-sign.d.ts.map +1 -0
- package/dist/schema.d.ts +17 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +37 -0
- package/dist/store-sql.d.ts +7 -1
- package/dist/store-sql.d.ts.map +1 -1
- package/package.json +11 -7
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Kysely } from 'kysely';
|
|
2
|
+
import { DB } from '../../schema';
|
|
3
|
+
export declare function insertTransaction(db: Kysely<DB>, row: {
|
|
4
|
+
commandId: string;
|
|
5
|
+
status?: string;
|
|
6
|
+
preparedTransaction?: string;
|
|
7
|
+
preparedTransactionHash?: string;
|
|
8
|
+
payload?: string | null;
|
|
9
|
+
userId: string;
|
|
10
|
+
createdAt?: string | null;
|
|
11
|
+
signedAt?: string | null;
|
|
12
|
+
origin?: string | null;
|
|
13
|
+
externalTxId?: string | null;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=008-transaction-external-tx-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"008-transaction-external-tx-id.d.ts","sourceRoot":"","sources":["../../../src/migrations-test/seeds/008-transaction-external-tx-id.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAO,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AAEjC,wBAAsB,iBAAiB,CACnC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,EACd,GAAG,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B,GACF,OAAO,CAAC,IAAI,CAAC,CAmBf"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Kysely } from 'kysely';
|
|
2
|
+
import { DB } from '../../schema';
|
|
3
|
+
export declare function insertUserPartyRight(db: Kysely<DB>, row: {
|
|
4
|
+
userId: string;
|
|
5
|
+
networkId: string;
|
|
6
|
+
partyId: string;
|
|
7
|
+
right: string;
|
|
8
|
+
}): Promise<void>;
|
|
9
|
+
export declare function insertUserRight(db: Kysely<DB>, row: {
|
|
10
|
+
userId: string;
|
|
11
|
+
networkId: string;
|
|
12
|
+
right: string;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=009-add-wallet-rights-columns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"009-add-wallet-rights-columns.d.ts","sourceRoot":"","sources":["../../../src/migrations-test/seeds/009-add-wallet-rights-columns.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAO,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AAEjC,wBAAsB,oBAAoB,CACtC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,EACd,GAAG,EAAE;IACD,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CAChB,GACF,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,eAAe,CACjC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,EACd,GAAG,EAAE;IACD,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;CAChB,GACF,OAAO,CAAC,IAAI,CAAC,CAKf"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Kysely } from 'kysely';
|
|
2
|
+
import { DB } from '../../schema';
|
|
3
|
+
export declare function insertTransaction(db: Kysely<DB>, row: {
|
|
4
|
+
commandId: string;
|
|
5
|
+
networkId: string;
|
|
6
|
+
userId: string;
|
|
7
|
+
status?: string;
|
|
8
|
+
preparedTransaction?: string;
|
|
9
|
+
preparedTransactionHash?: string;
|
|
10
|
+
payload?: string | null;
|
|
11
|
+
createdAt?: string | null;
|
|
12
|
+
signedAt?: string | null;
|
|
13
|
+
origin?: string | null;
|
|
14
|
+
externalTxId?: string | null;
|
|
15
|
+
}): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=010-transaction-with-network.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"010-transaction-with-network.d.ts","sourceRoot":"","sources":["../../../src/migrations-test/seeds/010-transaction-with-network.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAO,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AAEjC,wBAAsB,iBAAiB,CACnC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,EACd,GAAG,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B,GACF,OAAO,CAAC,IAAI,CAAC,CAqBf"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Kysely } from 'kysely';
|
|
2
|
+
import { DB } from '../../schema.js';
|
|
3
|
+
export declare function insertMessageRaw(db: Kysely<DB>, row: {
|
|
4
|
+
id: string;
|
|
5
|
+
status: string;
|
|
6
|
+
partyId: string;
|
|
7
|
+
publicKey: string;
|
|
8
|
+
message: string;
|
|
9
|
+
userId: string;
|
|
10
|
+
networkId: string;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
origin?: string | null;
|
|
13
|
+
signedAt?: string | null;
|
|
14
|
+
signature?: string | null;
|
|
15
|
+
}): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=012-add-messages-to-sign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"012-add-messages-to-sign.d.ts","sourceRoot":"","sources":["../../../src/migrations-test/seeds/012-add-messages-to-sign.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAO,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AAEpC,wBAAsB,gBAAgB,CAClC,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC,EACd,GAAG,EAAE;IACD,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,GACF,OAAO,CAAC,IAAI,CAAC,CAoBf"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Idp, UserId } from '@canton-network/core-wallet-auth';
|
|
2
|
-
import { Wallet, Transaction, Session, Network, WalletStatus, UpdateWallet, PartyLevelRight, UserLevelRight } from '@canton-network/core-wallet-store';
|
|
2
|
+
import { Wallet, Transaction, Session, Network, WalletStatus, UpdateWallet, PartyLevelRight, UserLevelRight, MessageRaw } from '@canton-network/core-wallet-store';
|
|
3
3
|
interface MigrationTable {
|
|
4
4
|
name: string;
|
|
5
5
|
executedAt: string;
|
|
@@ -74,6 +74,19 @@ interface TransactionTable {
|
|
|
74
74
|
signedAt: string | null;
|
|
75
75
|
externalTxId: string | null;
|
|
76
76
|
}
|
|
77
|
+
interface MessageRawTable {
|
|
78
|
+
id: string;
|
|
79
|
+
status: string;
|
|
80
|
+
partyId: string;
|
|
81
|
+
publicKey: string;
|
|
82
|
+
message: string;
|
|
83
|
+
origin: string | null;
|
|
84
|
+
userId: UserId;
|
|
85
|
+
networkId: string;
|
|
86
|
+
createdAt: string;
|
|
87
|
+
signedAt: string | null;
|
|
88
|
+
signature: string | null;
|
|
89
|
+
}
|
|
77
90
|
interface SessionTable extends Session {
|
|
78
91
|
id: string;
|
|
79
92
|
userId: UserId;
|
|
@@ -86,6 +99,7 @@ export interface DB {
|
|
|
86
99
|
userPartyRights: UserPartyRightTable;
|
|
87
100
|
userRights: UserRightTable;
|
|
88
101
|
transactions: TransactionTable;
|
|
102
|
+
messagesRaw: MessageRawTable;
|
|
89
103
|
sessions: SessionTable;
|
|
90
104
|
}
|
|
91
105
|
export declare const toIdp: (table: IdpTable) => Idp;
|
|
@@ -100,5 +114,7 @@ export declare const fromPartyRight: (right: string) => PartyLevelRight | undefi
|
|
|
100
114
|
export declare const fromUserRight: (right: string) => UserLevelRight | undefined;
|
|
101
115
|
export declare const fromTransaction: (transaction: Transaction, userId: UserId, networkId: string) => TransactionTable;
|
|
102
116
|
export declare const toTransaction: (table: TransactionTable) => Transaction;
|
|
117
|
+
export declare const fromMessageRaw: (message: MessageRaw, userId: UserId, networkId: string) => MessageRawTable;
|
|
118
|
+
export declare const toMessageRaw: (table: MessageRawTable) => MessageRaw;
|
|
103
119
|
export {};
|
|
104
120
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,GAAG,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAC1E,OAAO,EACH,MAAM,EACN,WAAW,EACX,OAAO,EACP,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,cAAc,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,GAAG,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAA;AAC1E,OAAO,EACH,MAAM,EACN,WAAW,EACX,OAAO,EACP,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,cAAc,EACd,UAAU,EACb,MAAM,mCAAmC,CAAA;AAE1C,UAAU,cAAc;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;CACrB;AAED,UAAU,QAAQ;IACd,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,OAAO,GAAG,aAAa,CAAA;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;CAChC;AAED,UAAU,YAAY;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,gBAAgB,EAAE,MAAM,CAAA;IACxB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;I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QAiBlC,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,OAAO,YAAY,KAAG,OAqB/C,CAAA;AAED,eAAO,MAAM,WAAW,GACpB,SAAS,OAAO,EAChB,SAAS,MAAM,KAChB,YAcF,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM,KAAG,WAe3D,CAAA;AAGD,eAAO,MAAM,wBAAwB,GACjC,QAAQ,YAAY,KACrB,sBAiBF,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,GAAG,IAAI,KAAG,YAIvD,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,OAAO,WAAW,KAAG,MAsB7C,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,KAAG,eAAe,GAAG,SAKhE,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,cAAc,GAAG,SAK9D,CAAA;AAED,eAAO,MAAM,eAAe,GACxB,aAAa,WAAW,EACxB,QAAQ,MAAM,EACd,WAAW,MAAM,KAClB,gBAaF,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,OAAO,gBAAgB,KAAG,WAwBvD,CAAA;AAED,eAAO,MAAM,cAAc,GACvB,SAAS,UAAU,EACnB,QAAQ,MAAM,EACd,WAAW,MAAM,KAClB,eAmBF,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,OAAO,eAAe,KAAG,UAoBrD,CAAA"}
|
package/dist/schema.js
CHANGED
|
@@ -178,3 +178,40 @@ export const toTransaction = (table) => {
|
|
|
178
178
|
}
|
|
179
179
|
return result;
|
|
180
180
|
};
|
|
181
|
+
export const fromMessageRaw = (message, userId, networkId) => {
|
|
182
|
+
if (message.userId !== userId) {
|
|
183
|
+
throw new Error(`MessageRaw userId mismatch: expected ${userId}, got ${message.userId}`);
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
id: message.id,
|
|
187
|
+
status: message.status,
|
|
188
|
+
userId: message.userId,
|
|
189
|
+
partyId: message.partyId,
|
|
190
|
+
publicKey: message.publicKey,
|
|
191
|
+
message: message.message,
|
|
192
|
+
origin: message.origin || null,
|
|
193
|
+
networkId,
|
|
194
|
+
createdAt: message.createdAt.toISOString(),
|
|
195
|
+
signedAt: message.signedAt?.toISOString() || null,
|
|
196
|
+
signature: message.signature ?? null,
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
export const toMessageRaw = (table) => {
|
|
200
|
+
const result = {
|
|
201
|
+
id: table.id,
|
|
202
|
+
status: table.status,
|
|
203
|
+
userId: table.userId,
|
|
204
|
+
partyId: table.partyId,
|
|
205
|
+
publicKey: table.publicKey,
|
|
206
|
+
message: table.message,
|
|
207
|
+
origin: table.origin || null,
|
|
208
|
+
createdAt: new Date(table.createdAt),
|
|
209
|
+
};
|
|
210
|
+
if (table.signedAt) {
|
|
211
|
+
result.signedAt = new Date(table.signedAt);
|
|
212
|
+
}
|
|
213
|
+
if (table.signature) {
|
|
214
|
+
result.signature = table.signature;
|
|
215
|
+
}
|
|
216
|
+
return result;
|
|
217
|
+
};
|
package/dist/store-sql.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Logger } from 'pino';
|
|
2
2
|
import { AuthContext, AuthAware, Idp } from '@canton-network/core-wallet-auth';
|
|
3
|
-
import { Store as BaseStore, Wallet, PartyId, Session, WalletFilter, Transaction, Network, StoreConfig, UpdateWallet, CurrentNetworkWalletFilter, TransactionStatusUpdate, UserLevelRight } from '@canton-network/core-wallet-store';
|
|
3
|
+
import { Store as BaseStore, Wallet, PartyId, Session, WalletFilter, Transaction, MessageRaw, MessageRawStatusUpdate, Network, StoreConfig, UpdateWallet, CurrentNetworkWalletFilter, TransactionStatusUpdate, UserLevelRight } from '@canton-network/core-wallet-store';
|
|
4
4
|
import { Kysely } from 'kysely';
|
|
5
5
|
import { DB } from './schema.js';
|
|
6
6
|
export declare class StoreSql implements BaseStore, AuthAware<StoreSql> {
|
|
@@ -41,6 +41,12 @@ export declare class StoreSql implements BaseStore, AuthAware<StoreSql> {
|
|
|
41
41
|
getLatestTransactionByCommandId(commandId: string): Promise<Transaction | undefined>;
|
|
42
42
|
listTransactions(): Promise<Array<Transaction>>;
|
|
43
43
|
removeTransaction(transactionId: string): Promise<void>;
|
|
44
|
+
private mergeMessageRawStatusUpdate;
|
|
45
|
+
setMessageRaw(message: MessageRaw): Promise<void>;
|
|
46
|
+
setMessageRawStatus(messageId: string, status: MessageRaw['status'], updates?: MessageRawStatusUpdate): Promise<void>;
|
|
47
|
+
getMessageRaw(messageId: string): Promise<MessageRaw | undefined>;
|
|
48
|
+
listMessageRaws(): Promise<Array<MessageRaw>>;
|
|
49
|
+
removeMessageRaw(messageId: string): Promise<void>;
|
|
44
50
|
}
|
|
45
51
|
export declare const connection: (config: StoreConfig) => Kysely<DB>;
|
|
46
52
|
//# sourceMappingURL=store-sql.d.ts.map
|
package/dist/store-sql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-sql.d.ts","sourceRoot":"","sources":["../src/store-sql.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EACH,WAAW,EAEX,SAAS,EAET,GAAG,EACN,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACH,KAAK,IAAI,SAAS,EAClB,MAAM,EACN,OAAO,EACP,OAAO,EACP,YAAY,EACZ,WAAW,EACX,OAAO,EACP,WAAW,EACX,YAAY,EACZ,0BAA0B,EAE1B,uBAAuB,EACvB,cAAc,EACjB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAmB,MAAM,EAAkC,MAAM,QAAQ,CAAA;AAEhF,OAAO,EACH,EAAE,
|
|
1
|
+
{"version":3,"file":"store-sql.d.ts","sourceRoot":"","sources":["../src/store-sql.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAC7B,OAAO,EACH,WAAW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AAY,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC;IAOV,oBAAoB,CACtB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,EAC7B,OAAO,GAAE,uBAA4B,GACtC,OAAO,CAAC,IAAI,CAAC;IA2BV,cAAc,CAChB,aAAa,EAAE,MAAM,GACtB,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAiB7B,+BAA+B,CACjC,SAAS,EAAE,MAAM,GAClB,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAoB7B,gBAAgB,IAAI,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAgB/C,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAe7D,OAAO,CAAC,2BAA2B;IAiB7B,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAcjD,mBAAmB,CACrB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,EAC5B,OAAO,GAAE,sBAA2B,GACrC,OAAO,CAAC,IAAI,CAAC;IA2BV,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAiBjE,eAAe,IAAI,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAkB7C,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAc3D;AAED,eAAO,MAAM,UAAU,GAAI,QAAQ,WAAW,eAuC7C,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canton-network/core-wallet-store-sql",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "SQL implementation of the Store API",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -23,13 +23,16 @@
|
|
|
23
23
|
"flatpack": "yarn pack --out \"$FLATPACK_OUTDIR\"",
|
|
24
24
|
"clean": "tsc -b --clean; rm -rf dist",
|
|
25
25
|
"test": "vitest run --project node",
|
|
26
|
-
"test:coverage": "vitest run --project node --coverage"
|
|
26
|
+
"test:coverage": "vitest run --project node --coverage",
|
|
27
|
+
"test:migrations": "vitest run --project migrations",
|
|
28
|
+
"migrations:check-lock": "tsx ../../scripts/src/check-migration-lock.ts",
|
|
29
|
+
"migrations:update-lock": "tsx ../../scripts/src/check-migration-lock.ts --update"
|
|
27
30
|
},
|
|
28
31
|
"dependencies": {
|
|
29
|
-
"@canton-network/core-ledger-client": "^1.
|
|
30
|
-
"@canton-network/core-rpc-errors": "^1.
|
|
31
|
-
"@canton-network/core-wallet-auth": "^1.
|
|
32
|
-
"@canton-network/core-wallet-store": "^1.
|
|
32
|
+
"@canton-network/core-ledger-client": "^1.3.1",
|
|
33
|
+
"@canton-network/core-rpc-errors": "^1.3.1",
|
|
34
|
+
"@canton-network/core-wallet-auth": "^1.3.1",
|
|
35
|
+
"@canton-network/core-wallet-store": "^1.3.1",
|
|
33
36
|
"better-sqlite3": "^12.6.2",
|
|
34
37
|
"commander": "^14.0.3",
|
|
35
38
|
"kysely": "^0.28.17",
|
|
@@ -39,6 +42,7 @@
|
|
|
39
42
|
"zod": "^4.3.6"
|
|
40
43
|
},
|
|
41
44
|
"devDependencies": {
|
|
45
|
+
"@testcontainers/postgresql": "^11.14.0",
|
|
42
46
|
"@types/better-sqlite3": "^7.6.13",
|
|
43
47
|
"@types/pg": "^8.18.0",
|
|
44
48
|
"@vitest/coverage-v8": "^4.1.2",
|
|
@@ -56,7 +60,7 @@
|
|
|
56
60
|
},
|
|
57
61
|
"repository": {
|
|
58
62
|
"type": "git",
|
|
59
|
-
"url": "git+https://github.com/canton-network/wallet
|
|
63
|
+
"url": "git+https://github.com/canton-network/wallet.git",
|
|
60
64
|
"directory": "core/wallet-store-sql"
|
|
61
65
|
}
|
|
62
66
|
}
|