@sentio/sdk 1.27.9 → 1.27.10
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/lib/aptos-codegen/codegen.js +7 -10
- package/lib/aptos-codegen/codegen.js.map +1 -1
- package/lib/aptos-codegen/typegen.d.ts +1 -1
- package/lib/aptos-codegen/typegen.js +11 -8
- package/lib/aptos-codegen/typegen.js.map +1 -1
- package/lib/builtin/aptos/0x1.d.ts +1 -0
- package/lib/builtin/aptos/0x1.js +2 -1
- package/lib/builtin/aptos/0x1.js.map +1 -1
- package/lib/builtin/aptos/0x3.d.ts +23 -22
- package/lib/builtin/aptos/0x3.js +27 -6
- package/lib/builtin/aptos/0x3.js.map +1 -1
- package/package.json +1 -1
- package/src/aptos-codegen/codegen.ts +7 -10
- package/src/aptos-codegen/typegen.ts +11 -9
- package/src/builtin/aptos/0x1.ts +1 -1
- package/src/builtin/aptos/0x3.ts +27 -27
|
@@ -2,7 +2,7 @@ import { MoveModule } from 'aptos-sdk/src/generated'
|
|
|
2
2
|
import { TypeDescriptor } from '../aptos/types'
|
|
3
3
|
import { moduleQname, moduleQnameForType, SPLITTER, VECTOR_STR } from '../aptos/utils'
|
|
4
4
|
|
|
5
|
-
function generateTypeForDescriptor(type: TypeDescriptor): string {
|
|
5
|
+
function generateTypeForDescriptor(type: TypeDescriptor, currentAddress: string): string {
|
|
6
6
|
// TODO &signer is defintely an address, but what if &OTHER_TYPE?
|
|
7
7
|
if (type.qname.startsWith('&')) {
|
|
8
8
|
return 'Address'
|
|
@@ -34,10 +34,10 @@ function generateTypeForDescriptor(type: TypeDescriptor): string {
|
|
|
34
34
|
if (elementTypeQname.startsWith('T') && !elementTypeQname.includes(SPLITTER)) {
|
|
35
35
|
return `${elementTypeQname}[] | string`
|
|
36
36
|
}
|
|
37
|
-
return generateTypeForDescriptor(type.typeArgs[0]) + '[]'
|
|
37
|
+
return generateTypeForDescriptor(type.typeArgs[0], currentAddress) + '[]'
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
const simpleName = generateSimpleType(type.qname)
|
|
40
|
+
const simpleName = generateSimpleType(type.qname, currentAddress)
|
|
41
41
|
if (simpleName.length === 0) {
|
|
42
42
|
console.error('unexpected error')
|
|
43
43
|
}
|
|
@@ -46,18 +46,20 @@ function generateTypeForDescriptor(type: TypeDescriptor): string {
|
|
|
46
46
|
}
|
|
47
47
|
if (type.typeArgs.length > 0) {
|
|
48
48
|
// return simpleName
|
|
49
|
-
return simpleName + '<' + type.typeArgs.map((t) => generateTypeForDescriptor(t)).join(',') + '>'
|
|
49
|
+
return simpleName + '<' + type.typeArgs.map((t) => generateTypeForDescriptor(t, currentAddress)).join(',') + '>'
|
|
50
50
|
}
|
|
51
51
|
return simpleName
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
function generateSimpleType(type: string): string {
|
|
54
|
+
function generateSimpleType(type: string, currentAddress: string): string {
|
|
55
55
|
const parts = type.split(SPLITTER)
|
|
56
56
|
if (parts.length < 2) {
|
|
57
57
|
return parts[0]
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
if (parts[0] === currentAddress) {
|
|
60
|
+
return parts.slice(1).join('.')
|
|
61
|
+
}
|
|
62
|
+
return '_' + parts.join('.')
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
export function parseMoveType(type: string): TypeDescriptor {
|
|
@@ -127,8 +129,8 @@ export function parseMoveType(type: string): TypeDescriptor {
|
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
// TODO ctx need to have type parameters
|
|
130
|
-
export function generateType(type: string,
|
|
131
|
-
return generateTypeForDescriptor(parseMoveType(type))
|
|
132
|
+
export function generateType(type: string, currentAddress: string): string {
|
|
133
|
+
return generateTypeForDescriptor(parseMoveType(type), currentAddress)
|
|
132
134
|
}
|
|
133
135
|
|
|
134
136
|
export class AccountModulesImportInfo {
|
package/src/builtin/aptos/0x1.ts
CHANGED
package/src/builtin/aptos/0x3.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { aptos } from "@sentio/sdk";
|
|
8
8
|
import { Address, MoveModule } from "aptos-sdk/src/generated";
|
|
9
9
|
|
|
10
|
-
import
|
|
10
|
+
import * as _0x1 from "./0x1";
|
|
11
11
|
|
|
12
12
|
export class token extends aptos.AptosBaseProcessor {
|
|
13
13
|
constructor(options: aptos.AptosBindOptions) {
|
|
@@ -248,11 +248,11 @@ export namespace token {
|
|
|
248
248
|
|
|
249
249
|
export class Collections {
|
|
250
250
|
static TYPE_QNAME = "0x3::token::Collections";
|
|
251
|
-
collection_data: table.Table<string, token.CollectionData>;
|
|
252
|
-
token_data: table.Table<token.TokenDataId, token.TokenData>;
|
|
253
|
-
create_collection_events: event.EventHandle<token.CreateCollectionEvent>;
|
|
254
|
-
create_token_data_events: event.EventHandle<token.CreateTokenDataEvent>;
|
|
255
|
-
mint_token_events: event.EventHandle<token.MintTokenEvent>;
|
|
251
|
+
collection_data: _0x1.table.Table<string, token.CollectionData>;
|
|
252
|
+
token_data: _0x1.table.Table<token.TokenDataId, token.TokenData>;
|
|
253
|
+
create_collection_events: _0x1.event.EventHandle<token.CreateCollectionEvent>;
|
|
254
|
+
create_token_data_events: _0x1.event.EventHandle<token.CreateTokenDataEvent>;
|
|
255
|
+
mint_token_events: _0x1.event.EventHandle<token.MintTokenEvent>;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
export class CreateCollectionEvent {
|
|
@@ -382,12 +382,12 @@ export namespace token {
|
|
|
382
382
|
|
|
383
383
|
export class TokenStore {
|
|
384
384
|
static TYPE_QNAME = "0x3::token::TokenStore";
|
|
385
|
-
tokens: table.Table<token.TokenId, token.Token>;
|
|
385
|
+
tokens: _0x1.table.Table<token.TokenId, token.Token>;
|
|
386
386
|
direct_transfer: Boolean;
|
|
387
|
-
deposit_events: event.EventHandle<token.DepositEvent>;
|
|
388
|
-
withdraw_events: event.EventHandle<token.WithdrawEvent>;
|
|
389
|
-
burn_events: event.EventHandle<token.BurnTokenEvent>;
|
|
390
|
-
mutate_token_property_events: event.EventHandle<token.MutateTokenPropertyMapEvent>;
|
|
387
|
+
deposit_events: _0x1.event.EventHandle<token.DepositEvent>;
|
|
388
|
+
withdraw_events: _0x1.event.EventHandle<token.WithdrawEvent>;
|
|
389
|
+
burn_events: _0x1.event.EventHandle<token.BurnTokenEvent>;
|
|
390
|
+
mutate_token_property_events: _0x1.event.EventHandle<token.MutateTokenPropertyMapEvent>;
|
|
391
391
|
}
|
|
392
392
|
|
|
393
393
|
export class WithdrawCapability {
|
|
@@ -535,7 +535,7 @@ export namespace token {
|
|
|
535
535
|
export namespace property_map {
|
|
536
536
|
export class PropertyMap {
|
|
537
537
|
static TYPE_QNAME = "0x3::property_map::PropertyMap";
|
|
538
|
-
map: simple_map.SimpleMap<string, property_map.PropertyValue>;
|
|
538
|
+
map: _0x1.simple_map.SimpleMap<string, property_map.PropertyValue>;
|
|
539
539
|
}
|
|
540
540
|
|
|
541
541
|
export class PropertyValue {
|
|
@@ -630,7 +630,7 @@ export namespace token_coin_swap {
|
|
|
630
630
|
amount: bigint;
|
|
631
631
|
min_price: bigint;
|
|
632
632
|
locked_until_secs: bigint;
|
|
633
|
-
coin_type_info: type_info.TypeInfo;
|
|
633
|
+
coin_type_info: _0x1.type_info.TypeInfo;
|
|
634
634
|
}
|
|
635
635
|
|
|
636
636
|
export interface TokenListingEventInstance
|
|
@@ -641,14 +641,17 @@ export namespace token_coin_swap {
|
|
|
641
641
|
|
|
642
642
|
export class TokenListings<T0> {
|
|
643
643
|
static TYPE_QNAME = "0x3::token_coin_swap::TokenListings";
|
|
644
|
-
listings: table.Table<
|
|
645
|
-
|
|
646
|
-
|
|
644
|
+
listings: _0x1.table.Table<
|
|
645
|
+
token.TokenId,
|
|
646
|
+
token_coin_swap.TokenCoinSwap<T0>
|
|
647
|
+
>;
|
|
648
|
+
listing_events: _0x1.event.EventHandle<token_coin_swap.TokenListingEvent>;
|
|
649
|
+
swap_events: _0x1.event.EventHandle<token_coin_swap.TokenSwapEvent>;
|
|
647
650
|
}
|
|
648
651
|
|
|
649
652
|
export class TokenStoreEscrow {
|
|
650
653
|
static TYPE_QNAME = "0x3::token_coin_swap::TokenStoreEscrow";
|
|
651
|
-
token_escrows: table.Table<token.TokenId, token_coin_swap.TokenEscrow>;
|
|
654
|
+
token_escrows: _0x1.table.Table<token.TokenId, token_coin_swap.TokenEscrow>;
|
|
652
655
|
}
|
|
653
656
|
|
|
654
657
|
export class TokenSwapEvent {
|
|
@@ -657,7 +660,7 @@ export namespace token_coin_swap {
|
|
|
657
660
|
token_buyer: Address;
|
|
658
661
|
token_amount: bigint;
|
|
659
662
|
coin_amount: bigint;
|
|
660
|
-
coin_type_info: type_info.TypeInfo;
|
|
663
|
+
coin_type_info: _0x1.type_info.TypeInfo;
|
|
661
664
|
}
|
|
662
665
|
|
|
663
666
|
export interface TokenSwapEventInstance
|
|
@@ -784,10 +787,10 @@ export class token_transfers extends aptos.AptosBaseProcessor {
|
|
|
784
787
|
export namespace token_transfers {
|
|
785
788
|
export class PendingClaims {
|
|
786
789
|
static TYPE_QNAME = "0x3::token_transfers::PendingClaims";
|
|
787
|
-
pending_claims: table.Table<token_transfers.TokenOfferId, token.Token>;
|
|
788
|
-
offer_events: event.EventHandle<token_transfers.TokenOfferEvent>;
|
|
789
|
-
cancel_offer_events: event.EventHandle<token_transfers.TokenCancelOfferEvent>;
|
|
790
|
-
claim_events: event.EventHandle<token_transfers.TokenClaimEvent>;
|
|
790
|
+
pending_claims: _0x1.table.Table<token_transfers.TokenOfferId, token.Token>;
|
|
791
|
+
offer_events: _0x1.event.EventHandle<token_transfers.TokenOfferEvent>;
|
|
792
|
+
cancel_offer_events: _0x1.event.EventHandle<token_transfers.TokenCancelOfferEvent>;
|
|
793
|
+
claim_events: _0x1.event.EventHandle<token_transfers.TokenClaimEvent>;
|
|
791
794
|
}
|
|
792
795
|
|
|
793
796
|
export class TokenCancelOfferEvent {
|
|
@@ -875,11 +878,8 @@ export namespace token_transfers {
|
|
|
875
878
|
);
|
|
876
879
|
}
|
|
877
880
|
|
|
878
|
-
function loadAllTypes(_r: aptos.TypeRegistry) {
|
|
879
|
-
|
|
880
|
-
event.loadTypes(_r);
|
|
881
|
-
simple_map.loadTypes(_r);
|
|
882
|
-
type_info.loadTypes(_r);
|
|
881
|
+
export function loadAllTypes(_r: aptos.TypeRegistry) {
|
|
882
|
+
_0x1.loadAllTypes(_r);
|
|
883
883
|
|
|
884
884
|
_r.load(token.ABI);
|
|
885
885
|
_r.load(property_map.ABI);
|